Share via


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 Ee341498.xtlink_newWindow(en-us,Expression.40).png and Silverlight DependencyProperty Class Ee341498.xtlink_newWindow(en-us,Expression.40).png 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 Ee341498.xtlink_newWindow(en-us,Expression.40).png and Creating a Control That Has a Customizable Appearance Ee341498.xtlink_newWindow(en-us,Expression.40).png on MSDN.

General information about creating custom controls can be found at WPF Control Customization Ee341498.xtlink_newWindow(en-us,Expression.40).png and Silverlight Control Customization Ee341498.xtlink_newWindow(en-us,Expression.40).png 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

Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.