How to use Gird in Windows Apps?
I want to create a Login form. I have used grid and used but the Rows are not aligned properly, How can I do that?
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <Grid.ColumnDefinitions> <ColumnDefinition Width="67*"/> <ColumnDefinition Width="293*"/> </Grid.ColumnDefinitions> <StackPanel> <TextBlock Text="Name" Height="32" Margin="0,0,0.333,0" ></TextBlock> <TextBlock Text="Last Name" Height="30" Margin="0,0,0.333,0" ></TextBlock> <TextBlock Text="Address"></TextBlock> </StackPanel> <StackPanel Grid.Column="1"> <TextBox></TextBox> <TextBox></TextBox> <TextBox></TextBox> </StackPanel> </Grid>
You should define the rows and columns in Grid.
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="67*"/>
<ColumnDefinition Width="293*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="45"></RowDefinition>
<RowDefinition Height="45"></RowDefinition>
<RowDefinition Height="45"></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Text="Name" Grid.Column="0" Grid.Row="0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="Last Name" Grid.Column="0" Grid.Row="1" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="Address" Grid.Column="0" Grid.Row="2" VerticalAlignment="Center"></TextBlock>
<TextBox Grid.Column="1" Grid.Row="0" Height="30"></TextBox>
<TextBox Grid.Column="1" Grid.Row="1" Height="30"></TextBox>
<TextBox Grid.Column="1" Grid.Row="2" Height="30"></TextBox>
</Grid>