Creating custom controls

Microsoft Expression Blend provides several different controls that you can style and use in your applications. However, if these controls do not meet a specific need that you have, you can create a custom control by programming a class that inherits from one of the System.Windows.Controls classes of Windows Presentation Foundation (WPF) or Microsoft Silverlight.

To include properties in your custom control that can be modified in the Properties panel of Expression Blend, define dependency properties in your class. For more information, see the WPF DependencyProperty Class and Silverlight DependencyProperty Class on MSDN.

To enable your custom control to be styled by modifying a template in Expression Blend, you'll have to include Generic.xaml with your control. For more information, see Guidelines for Designing Stylable Controls and Creating a Control That Has a Customizable Appearance on MSDN.

General information about creating custom controls can be found at WPF Control Customization and Silverlight Control Customization on MSDN.

In This Section

Try it: Create a custom control with custom properties

Working with code

See also


Styling a control that supports templates

Designing a user control from scratch