Reputation: 2095
I am using this DataGrid
(which is nothing more than a DataGrid
with more stuff). I would like to be able to resize vertically the size of the grid, not the size of its rows or columns. In the image I attached you can a see a huge blank space between the first row and the bottom of the window. What I need is that when the mouse hovers by the top of the grid (somewhere in the top corner of the grid's header) to have a resize cursor. When resizing, the size of the elements in the grid don't need to change, just the total height of the grid.
Also, the maximum height the grid should always be is just bellow the "Add event" buttom.
In other words, I want the user to be able to go from this:
To this:
Upvotes: 1
Views: 2891
Reputation: 10208
One thing you can try with this is to use a GridSplitter
. I'm presuming you have a Grid
layout that is something like this:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50" /> // This is where the button lives
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<DataGrid x:Name="MyGrid" Grid.Row="1" Grid.RowSpan="1" />
</Grid>
If you add a GridSplitter
to row one you'll get the desired effect:
<GridSplitter
ResizeDirection=”Rows”
Grid.Row=”1″
Width=”Auto”
Height=”3″
HorizontalAlignment=”Stretch”
VerticalAlignment=”Stretch”
Margin=”0″/>
Upvotes: 1