Custom Control | User Control |
A loosely coupled control w.r.t code and UI | A tightly coupled control w.r.t code and UI |
Derives from Control |
Derives from UserControl |
Defines UI in a ResourceDictionary |
Defines UI as normal XAML |
UI is skinable | Child controls are skinable |
Has dynamic layout | Has static layout |
UI can be changed in different projects | UI is fixed and can't have different looks in different project |
Has full toolbox support | Can't be added to the toolbox |
Defines a single control | Defines a set of controls |
More flexible | Not very flexible like a Custom Control |
Requires in-depth knowledge of Silverlight UI Model | Does not require indepth knowledge of the UI Model |
- User Control is a page file with extension .ascx which can only be used within a single application. But custom controls are assemblies(dll files) that can be used in multiple applications.
- User Controls cannot be added to the ToolBox of VS.NET . To use a User Control with in an aspx page you have to drag the user Control from the solution explorer to designer page. But Custom Controls can be added to ToolBox of VS.NET.
- User Controls can be viewed as a sort of generic controls during the design time. The proper GUI of user controls can be viewed only during the run time. But Custom Controls can be viewed during the design time.
- User controls are created from existing Webserver and html server controls. But a developer who creates custom controls have to render every thing from the scratch.
- Since the dll assembly of a custom control is being used,a custom control developed in C# can be used in a project developed in VB.NET or any other managed code and vice versa. This is not possible with user controls.They are language specific
No comments:
Post a Comment