Is there a difference between window and user control? It seems to me that these two are exactly the same. So which one should I use and when? (I tried googling this phrase and I couldn't find anything)
5 Answers
A Window
is as the name suggests a window, it can be closed, minimized, resized etc. This should be quite intuitive.
A UserControl
on the other hand is a composite component/module which can be placed inside other controls and is itself made up of controls (possibly even other UserControls), the main use for UserControls is reusability, encapsulation and loose coupling, some applications can be broken up into a set of UserControls of which each one provides a certain functionality.[citation needed]

- 166,899
- 29
- 327
- 400
We make user control if we want to reuse it. As name says User Control it means some control like grid,combo box like that.If i need same grid on 3-4 windows then i will prefer to make it as User Control.If it is not reusable i will define my grid in the required window.At last you paste your user control on some window.
Conclusion :- If you want to reuse the control then make it as a user control otherwise define it in required window.

- 1,916
- 1
- 13
- 22
A window is managed by the OS and is placed on the desktop.
A UserControl is managed by wpf and is placed in a Window or in another UserControl.
Applications could be created by having a single Window and displaying lots of UserControls in that Window.

- 50,210
- 11
- 84
- 115
wpf window is a Win32 window, but user control is just something of wpf, not a Win32 window.

- 517
- 4
- 14
I presume you refer to the windows forms. Usually they are classified as user controls and custom controls - same stands for web forms as well. For more information you can refer to these links control vs user control in winforms and over view of user controls and custom contorls.
-
1Uhm, no, it's wpf (Windows Presentation Foundation), so I think it's different? – Apr 24 '11 at 18:53
-
The concept of user control and custom control is similar in WPF too. In user control you make controls as a composition of other controls and in custom control you extend an existing control. Its the same concept. – rageit Apr 26 '11 at 00:29