简体   繁体   中英

GridSplitter not working when used in Grid present in DockPanel

I am stuck in resolving the GridSplitter to work.I have a DockPanel which has a Grid which is DockPanel.Dock="Bottom" and I have a GridSplitter which is also DockPanel.Dock="Bottom".

But the GridSplitter is not working and not allowing to resize the layout. Maybe I am doing is completely wrong.Please correct me and tell me how can I perform this GridSplitter functionality.

Here is the Xaml I have:

 <DockPanel Name="DocMain" LastChildFill="True">
  <Grid DockPanel.Dock="Bottom">

            <ScrollViewer Style="{StaticResource NotificationRegion}">         

                <TextBox Style="{StaticResource NotificationTextBlockStyle}" Name="Notification_Block"
                     Text="{Binding TxtBlkNotificationBar}"/>

            </ScrollViewer>

 <GridSplitter DockPanel.Dock="Bottom" Background="Black" Height="2" Width="Auto" ResizeDirection="Rows" HorizontalAlignment="Stretch"/>
  </Grid>

</DockPanel>

Gridsplitter only works inside the grid its supposed to be splitting, for example

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition Width="5"/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>

        <GridSplitter Grid.Column="1" ResizeBehavior="PreviousAndNext" BorderBrush="black" BorderThickness="5"/>
    </Grid>

makes a grid with 3 columns with 2 columns for content and one for the splitter, gridsplitter is specified to be inside column #2 and resize the cells its placed between.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM