In WPF, what is the differences between CustomControls and UserControls? When should I use each?
1 Answer
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