Tutorial on WPF Controls and Layout

Here in this article we will discuss different Controls and Layout in WPF.

New to Office 365 SharePoint Online? Get Office 365 Enterprise E3 Subscription & Try out all the features

In WPF, “control” applies to a category of WPF classes that are hosted in either a window or a page, have a user interface (UI), and implement some behavior.

The built-in WPF controls are listed here.

Buttons: Button and RepeatButton.

Dialog Boxes: OpenFileDialog, PrintDialog, and SaveFileDialog.

Digital Ink: InkCanvas and InkPresenter.

Documents: DocumentViewer, FlowDocumentPageViewer, FlowDocumentReader, FlowDocumentScrollViewer, and StickyNoteControl.

Input: TextBox, RichTextBox, and PasswordBox.

Layout: Border, BulletDecorator, Canvas, DockPanel, Expander, Grid, GridView, GridSplitter, GroupBox, Panel, ResizeGrip, Separator, ScrollBar, ScrollViewer, StackPanel, Thumb, Viewbox, VirtualizingStackPanel, Window, and WrapPanel.

Media: Image, MediaElement, and SoundPlayerAction.

Menus: ContextMenu, Menu, and ToolBar.

Navigation: Frame, Hyperlink, Page, NavigationWindow, and TabControl.

Selection: CheckBox, ComboBox, ListBox, TreeView, and RadioButton, Slider.

User Information: AccessText, Label, Popup, ProgressBar, StatusBar, TextBlock, and ToolTip.

Controls most often detect and respond to user input. The WPF input system uses both direct and routed events to support text input, focus management, and mouse positioning. Applications often have complex input requirements. WPF provides a command system that separates user input actions from the code that responds to those actions.

When you create a UI, you arrange your controls by location and size to form a layout. A key requirement of any layout is to adapt to changes in window size and display settings. Rather than forcing you to write the code to adapt a layout in these circumstances, WPF provides a first-class, extensible layout system for you.

The aim of the layout system is relative positioning, which increases the ability to adapt to changing window and display conditions. In addition, the layout system manages the negotiation between controls to determine the layout. The negotiation is a two-step process: first, a control tells its parent what location and size it requires; second, the parent tells the control what space it can have.

The layout system is exposed to child controls through base WPF classes. For common layouts such as grids, stacking, and docking, WPF includes several layout controls:

Canvas: Child controls provide their own layout.

DockPanel: Child controls are aligned to the edges of the panel.

Grid: Child controls are positioned by rows and columns.

StackPanel: Child controls are stacked either vertically or horizontally.

VirtualizingStackPanel: Child controls are virtualized and arranged on a single line that is either horizontally or vertically oriented.

WrapPanel: Child controls are positioned in left-to-right order and wrapped to the next line when there are more controls on the current line than space allows.

Check out Best Alternative to InfoPath -> Try Now


(Installation & Features)

About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →