Reputation: 21
Firstly, my window is set to 900px height and 600px width. It contains a datagrid with 4 columns. I've created a template for cells, the widths are, say, 100px. Now when I change the window sizes, I want cells' width to grow proportionally to size of windows. I tried to add datagrid sizes change event but it didn't work.
How can I do this? Thanks!
Update: one more question: Have any way to make the sizes of a cell is the same whether they're empty or not.
Upvotes: 0
Views: 660
Reputation: 5274
In grid definition
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="5*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5*" MinWidth="70" />
<ColumnDefinition Width="Auto" />
...
MinWidth : Gets or sets the minimum width constraint of the element.
Upvotes: 1