Saturday, 7 December 2013

Using Layout Controls

Although you can use fixed positioning to place controls on a WPF window, it’s
positioning usually works well for a fixed resolution size but it doesn’t scale we
To overcome the limitations of fixed positioning, WPF offers several layout con
position other controls within it using a relative positioning format. One of the
other controls is the Grid. As seen previous post, a Grid control contains columns
its child controls. The height and width of the columns and rows can be set to a
takes up as much space as needed by the contained control. The *setting take
The Grid control is often used to lay out data entry forms. The following code l
collect user information. The resulting form (in the Visual Studio designer) is s
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="28" />
<RowDefinition Height="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="200" />
<ColumnDefinition Width="*" />
<Label Grid.Row="0" Grid.Column="0" Content="Name:"/>
<Label Grid.Row="1" Grid.Column="0" Content="Old Password:"/>
<Label Grid.Row="2" Grid.Column="0" Content="New Password:"/>
<Label Grid.Row="3" Grid.Column="0" Content="Confirm Password:
<TextBox Grid.Column="1" Grid.Row="0" Margin="3" />
<TextBox Grid.Column="1" Grid.Row="1" Margin="3" />
<TextBox Grid.Column="1" Grid.Row="2" Margin="3" />
<TextBox Grid.Column="1" Grid.Row="3" Margin="3" />
<Button Grid.Column="1" Grid.Row="4" HorizontalAlignment="Righ
MinWidth="80" Margin="0,0,0,8" Content="Submit" />
Share it Please


Post a Comment

Copyright @ 2013 Learn About Computers and Programming. Designed by Templateism | Love for The Globe Press