That was a couple of months back, and I still only use regular user controls. I see however that for my use, the regular user control is enough! When adding a custom control, you will automatically get a resource file with xaml (Generic.xaml) defining the styles of the custom controls, hence adding the possibility for easy theming. And I guess this is one of the main benefits of the custom control, namely to enhance existing user controls, and giving the consumer the possibility to use theming, eg. when developing controls for third party use.
Custom Control
- Used when enhancing an existing control with new features
- Supports theming for consumers.
- WPF has a very good support for theming giving you the ability to customize the control to what every style you want, eg. when added/used in third party libraries.
- Only a cs file
- Style kept in Generic.xaml
- The user control won't support theming by consumers
- The developer of the user control have full styling possibilities (of course)
- Used when composing it for your own consumption
- Used when you know third party theming is not an option.
- Derives from UserControl

0 kommentarer:
Post a Comment