WPF dock control to cell in grid
If I have a 2 by 2 Grid how d开发者_开发问答o I get a button to fill the entire cell? Do I have to use a trigger? How would I get the column's width in that case?
Thanks Ian
The Button
by default will consume the entire cell.
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button></Button>
</Grid>
You can get the columns width by accessing the ColumnDefinitions
collection.
Grid g = new Grid();
g.ColumnDefinitions[0].Width;
精彩评论