Sunday, January 19, 2014

Difference between Grid, StackPanel, WrapPanel, DockPanel and Canvas in WPF

Grid
Grid is the default container where we can arrange the elements in table format.
StackPanel
By using StackPanel we can arrange the elements vertically or horizontally.We can arrange child elements in a panel without affecting the size of the lements.
WrapPanel
WrapPanel is same as StackPanel but it wraps the elements accordingly to size of the form.  The control in Wrap Panel is shifted to the next line automatically if the form size is getting changed.
DockPanel
DockPanel is used to place the control in exact location like as Left, Right, Top and Bottom.
If we not specify any position then control will occupy entire space on the container.
Canvas
Canvas is used to place the control by specifying the position in pixel format.We can use Canvas.Left, Canvas.Right,Canvas.Bottom and Canvas.Top.

2 comments:

Deyvson Santos said...

Muito bom !!!!

Max said...

Muchas Gracias!!

Copyright © Codingnodes,2014.All Rights Reserved.