Every time someone asks me to provide an interface to input values, I find myself creating grids with a lot of rows and columns. Tried to look for an answer to this question but find it hard
Code
<Grid HorizontalAlignment="Left" VerticalAlignment="Top">
<Grid.Resources>
<Style TargetType="RowDefinition">
<Setter Property="Height" Value="25"/>
</Style>
<Style TargetType="TextBox">
<Setter Property="Margin" Value="2"/>
</Style>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="150"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0">Input 1</TextBlock>
<TextBox Grid.Row="0" Grid.Column="1"></TextBox>
<TextBlock Grid.Row="1" Grid.Column="0">Input 2</TextBlock>
<TextBox Grid.Row="1" Grid.Column="1"></TextBox>
</Grid>
Result
Questions that come to mind are if there are any performance considerations or if there is another method that removes the need of maintaining attributes with row and column numbers.
The option of creating a custom control with label and input is discussed here however that would introduce more overhead.
Creating the layout seems somewhat repetitive which makes me wonder if there is a tool for exactly this.
Question
Is this the most optimal way of doing it? If not, why and how should it be done?