Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Window vs User Control

People also ask

What is user control in WPF?

User controls, in WPF represented by the UserControl class, is the concept of grouping markup and code into a reusable container, so that the same interface, with the same functionality, can be used in several different places and even across several applications.

What is difference between window and page in WPF?

Window is the root control that must be used to hold/host other controls (e.g. Button) as container. Page is a control which can be hosted in other container controls like NavigationWindow or Frame. Page control has its own goal to serve like other controls (e.g. Button). Page is to create browser like applications.

How do I add a page in WPF?

Step 1: Create an empty WPF using Visual Studio, enter the name for the application and click on OK. Step 2: Create a button using the following code or drag and drop a button from the ToolBox of Visual Studio 2013.


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]


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.


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.

Applcations could be created by have a single Window and displaying lots of UserControls in that Window.


wpf window is a Win32 window, but user control is just something of wpf, not a Win32 window.