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

Expander + Grid Splitter

$
0
0

Hi,

I have grid with 3 rows, the first row containing an Expander control, the second row containing a grid splitter and the last one containing a button.

I am setting the height of the first rowdefinition from the ViewModel via binding. (In the xaml below, i have set a hard coded value for convenience.)

Problem:

When the expander is visible & open, If I drag the grid splitter towards the top of the window, it is making the expander disappear and to tackle this, I have set MinHeight in the first row definition and things are fine but when I set the visibility of the expander to collapse, expander is not showing up and the button "Click" is starting after the minimum height set for the first row. Looking forward for a solution for this problem.

Below is the xaml and the snapshot of the problem stated above.

 <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="200" MinHeight="20"/> <-- Setting it using binding from viewmodel -->
            <RowDefinition Height="5"/>
            <RowDefinition Height="30"/>
        </Grid.RowDefinitions>

        <Expander Grid.Row="0" IsExpanded="True">
            <DataGrid>
                <DataGrid.Columns>
                    <DataGridTextColumn Header="Name"/>
                    <DataGridTextColumn Header="Age"/>
                    <DataGridTextColumn Header="Address"/>
                </DataGrid.Columns>
            </DataGrid>
        </Expander>

        <GridSplitter Grid.Row="1" Height="5" HorizontalAlignment="Stretch" ResizeBehavior="PreviousAndCurrent"/>
        
        <Button Content="Click" Grid.Row="2" Margin="3" Width="60"/>
    </Grid>

Regards,

Ramakrishna


Ramakrishna


Viewing all articles
Browse latest Browse all 18858

Trending Articles



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