Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

[WPF] GridSplitter and Height of Item

$
0
0

Hi,
I have this code:

<Grid Height="Auto" Width="Auto" Name="MainGrid"><Grid.RowDefinitions><RowDefinition Height="auto" /><RowDefinition Height="*" /><RowDefinition Height="2"/><RowDefinition Height="auto" /><RowDefinition Height="35" /></Grid.RowDefinitions><!-- IN ROW 1 --><GroupBox Margin="0,0,0,10" Grid.Row="1" Visibility="Visible" Name="stackPanelSearchResult" BorderBrush="#FF39799E"><GroupBox.Header>
                [...]</GroupBox.Header><Grid VerticalAlignment="Top"><Grid.RowDefinitions><RowDefinition Height="auto" /><RowDefinition Height="*" /></Grid.RowDefinitions><StackPanel Grid.Row="0" Name="stackPanelToolbarCommand" Orientation="Horizontal" Margin="0,0,0,0" Visibility="Visible" Height="50">
                    [...]</StackPanel><DataGrid Name="dgSample" Grid.Row="1">
                    [...]</DataGrid></Grid></GroupBox><!-- IN ROW 2 --><GridSplitter Grid.Row="2" Name="grdSplitter" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="LightGray"
                      ShowsPreview="True" Width="auto" Height="2" ResizeDirection="Rows" Visibility="Collapsed" /><StackPanel Name="TabSmplDetailHistory" Grid.Row="3" Margin="0,10,0,0" Width="auto" Height="auto" Visibility="Collapsed"><Button Name="closeButtonTabControl" Click="closeButtonTabControl_Click" Width="20" Height="20" Content="Close" />
            [...]</StackPanel></Grid>

To default, grdSplitter and TabSmplDetailHistory is Collapsed.
When the user click on one row of dgSample datagrid, the visibility of grdSplitter and TabSmplDetailHistory is set on Visible.

If I click on closeButtonTabControl and I set the Visibility of grdSplitter and TabSmplDetailHistory to Collapsed, my dgSample height is restore to default height, in this case *.

But, If I grad the gridSplitter to move so that the height of DataGrid the height is decreased, when I click on closeButtonTabControl, the height of dgSample datagrid is not restore, but the height remains the 'forced' by GridSplitter. 

How can I restore the height of DataGrid to *?

Thanks.


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>