#1,135 – Alternatives to Creating a Custom Control

You’ll typically use existing WPF controls when creating an application’s user interface.  You can set property values for the control to customize both the look and behavior of the control.

If an existing control doesn’t provide the desired behavior or visual appearance, you can build a custom control.

Creating a custom control involves a fair amount of work.  Before deciding to create a new control, you should consider the alternatives listed below.

  • Use an existing control
    • Modify behavior or appearance using properties
    • Execute code in response to the control’s events
  • Use a control template to change the appearance of an existing control
  • Use a data template to change how bound data will be rendered by the control
  • Use triggers to change something in the control based on an event or changing data
  • Use value converter to customize data provided to the control
  • Use attached property to provide custom behavior