Powered by Blogger.

Saturday, March 1, 2014

Tutorial on WPF Controls and Layout




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

Also you can check out:

- RegularExpressionValidator example in Asp.Net

- How to Generate a Strong Name for the Assembly and How to Build the Assembly and Add it to the Global Assembly Cache ?

- The App_Code Folder in Asp.Net

Controls:
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.

Layout:
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.



0 comments

Post a Comment