I have a simple grid layout which is just hosting several labels and textboxes. Labels in the first column, boxes in the second.
Whenever I add a new box, I have to add an empty <RowDefinition /> in to my <Grid.RowDefinitions> block to allow it to occupy a new row. Since I don’t have any style attached to these rows, is there some sort of shorthand that would prevent having to to this?
<Grid.ColumnDefinitions>
<ColumnDefinition Width="65" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
No, there isn’t a short hand method for this, but you could write your own solution, or use a framework where someone already has.
For example, the CODE framework allows you to define markup as shown in Listing 6 here. This uses a custom panel to greatly simplify the definition of common editing forms.
You could download the source and have a look at their implementation and tailor it for your needs.