Search code examples
wpfxamlgridsplitter

GridSplitter not drag-able


I have a grid with a single splitter in it and two TreeVeiw's.

I have been unable to get the splitter to move and re-size both treeveiws. I have tried changing a few options as of the related questions, but none of these have helped. What am i doing wrong?

        <Grid 
            Grid.Column="0" 
            HorizontalAlignment="Stretch" 
            Name="grid2" 
            VerticalAlignment="Stretch" 
            Background="White">
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="5" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <TreeView 
                Grid.Row="0"
                Height="Auto"
                HorizontalAlignment="Stretch"
                Name="treeView1"
                VerticalAlignment="Stretch"
                Width="Auto" />
            <GridSplitter 
                Grid.Row="1"
                Grid.RowSpan="2"
                ResizeDirection="Rows"
                Height="5"
                HorizontalAlignment="Stretch"
                Name="gridSplitter2"
                VerticalAlignment="Top"
                Width="Auto"
                ResizeBehavior="PreviousAndNext" />
            <TreeView 
                Grid.Row="2"
                Height="Auto"
                HorizontalAlignment="Stretch"
                Name="treeView2"
                VerticalAlignment="Stretch"
                Width="Auto" />
        </Grid>

Solution

  • As correctly said by Novitch S, i simply had to remove the Grid.RowSpan from the GridSplitter.