What is the difference between User Control, Custom Control and Component?

The main difference between User Control, Custom Control and Component is that they inherit from different levels in the inheritance tree:

MyComponent
   |-> Component

MyCustomControl
   |-> Control
          |-> Component

MyUserControl
   |-> ContainerControl
          |-> ScrollableControl
                 |-> Control
                        |-> Component

So, in short you get a different amount of pre-wired functionality with the different options.

When would you use the different options? (these are thoughts and opinions, not truths)

  • Create a component if you want to provide functionality without UI (such as Timer components, data sources, …)
  • Create a custom control if you want to make a component where you have full control over its visual appearance, and you don’t want any baggage of unnecessary functionality. Typical cases would be simple controls with limited functionality (such as a button)
  • Create a user control if you are going to combine existing controls into reusable building blocks (such as two lists with buttons where you can move items between the lists).

Leave a Comment