Creating custom controls

Blend for Visual Studio 2012 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 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 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

Concepts

Styling a control that supports templates

Designing a user control from scratch