Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I have a grid with three rows. The middle of these three is a GridSplitter control and the content of the bottom row is a stackpanel that has visibility controlled from code (it is basically a notification area).

XML
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="5" />
            <!-- Main content row -->
            <RowDefinition Height="*" />
            <!-- Splitter row -->
            <RowDefinition Height="Auto" />
            <!-- Messages row -->
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

<!-- content for top of grid.... -->

<!-- Information Messages splitter -->
        <ctrl:GridSplitter x:Name="InformatioMessagesSplitter" Grid.Row="2" Grid.Column="0" 
                           Grid.ColumnSpan="3"
                           VerticalAlignment="Center" HorizontalAlignment="Stretch" 
                           Height="3"
                           removed="Gray" 
                           />

<StackPanel x:Name="InformationMessagesPanel"
                    Grid.Row="0"
                    Height="Auto"
                    removed="LightBlue" 
                    Visibility="{Binding Source={StaticResource MainPageViewModel},Path=InformationMessagePanelVisibility,Mode=OneWay}"
                    >

   <!-- Content goes here -->

</StackPanel>


Now - if the property InformationMessagePanelVisibility is changed, the lower stack panel shows/hides OK and the main content resizes accordingly.

However if the user moves the GridSplitter control then thereafter the property InformationMessagePanelVisibility does show/hide the stack panel but the row sizes don't auto-adjust any more when the lower panel is hidden.

Any ideas?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900