Thursday, May 5, 2011

WPF: CustomControls vs UserControls

In WPF, what is the differences between CustomControls and UserControls? When should I use each?

From stackoverflow
  • UserControl (Composition):

    • Composes multiple existing controls into a reusable "group"
    • Consists of a XAML and a code behind file
    • Cannot be styled/templated
    • Derives from UserControl


    CustomControl (Extending an existing control)

    • Extends an existing control with additional features
    • Consists of a code file and a default style in Themes/Generic.xaml
    • Can be styled/templated
    • The best approach to build a control library


    Source: The differences between CustomControls and UserControls

0 comments:

Post a Comment