I have a grid with two labels.
<Grid>
<Label Grid.Row="0" Content="Hello" Height="20"></Label>
<Label Grid.Row="1" Content="World" Height="20"></Label>
</Grid>
I know that I can add for each row, but if I have 100 rows I need to add 100 rows definitions. Is there a way to globally set the row definitions so that all rows/columns will inherited their property?
You could always subclass
Grid
. Set each child'sGrid.Row
property, and add the row definitions, manually when the control loads. You could add a property to the control to specify a uniform height for each row. For example:Usage:
(Although, as some comments pointed out, the above is basically just a StackPanel only slower.)