You already have some great answers that explain the differences but also understand that custom controls and UserControls
have different purposes:
A UserControl
typically encapusulates some sort of composite behaviour. If you have an application that needs to edit contact details in many places, for example, you could create a custom control that has the labels and text fields for all the data laid out with a submit button that has the relevant code and reuse this control throughout your application.
A custom control is a control that is derived from one of the WPF
control classes (E.G. Control
, ContentControl
etc.) and has to be created in code.
These control usually have a single cohesive purpose (think TextBox
, ComboBox
, Label
) rather than acting together as a whole (although this doesn't have to be the case).
UserControl
's are usually easier for people unfamiliar with WPF
as they can be visually designed.
My suggestion would be to start off with a UserControl
. You can always refactor this into a custom control at a later date as you become more familiar with the way WPF
works. Creating your control as a custom control will require knowledge of ControlTemplate
s and Style
s as you will need to provide your own to define a look and feel for your control.
When all is said and done, as long as the control behaves correctly, it doesn't matter which approach you use.
See this post for an example of two approaches to the same problem. The post author wanted a control which can present modal content in front of the primary content. The post author actually answered his own question by implementing it as a UserControl
. I have added an answer to the post which creates the control as a custom control but both have the same end effect.