I am creating a form in WPF using Grid
to design my form.
Here is my sample code.
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width=".6*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Label Grid.Column="0">Company Name</Label>
<TextBox Grid.Column="1"></TextBox>
<Label Grid.Column="0" Grid.Row="1">Company Name</Label>
<TextBox Grid.Column="1" Grid.Row="1"></TextBox>
<Label Grid.Column="0" Grid.Row="2">Company Name</Label>
<TextBox Grid.Column="1" Grid.Row="2"></TextBox>
</Grid>
But this is the output of my form.
I want to give some space from top to textbox, so that it looks better.
Is there any way, I can give top margin to textbox as I don't want to write Margin="0,20,0,0"
on each textbox?
Or should I use other layout control instead of Grid
to design my form?
Please suggest me.