views:

208

answers:

2

Hi,

First off I'm new to XAML so forgive me if I've done something stupid.

I have stripped down my page to the following example XAML (viewable in XamlPad):

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:sys="clr-namespace:System;assembly=mscorlib" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
    <Grid ShowGridLines="True">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="200" MinWidth="150"  />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="3*" />
            <!--<RowDefinition Height="Auto" />-->
            <RowDefinition MaxHeight="25" Height="25" MinHeight="25" />
            <RowDefinition Height="1*"/>
        </Grid.RowDefinitions>
        <Grid Grid.RowSpan="4" Grid.Row="0" Grid.Column="0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
        <GridSplitter Grid.Row="0" Grid.RowSpan="4" Width="4" />
        <Frame >
        </Frame>
        <GridSplitter Grid.Row="0" Height="4" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" />
        <Grid Grid.Column="2" Grid.Row="2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
        <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Grid.Column="2" Grid.Row="3">
            <Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
        </ScrollViewer>
    </Grid>
</Page>

What I want to happen is for the Horizontal Grid Splitter to resize the top panel, moving the bottom Grid (which I want to keep at 25 height) and Scrollviewer controls down.

I've tried putting the Horizontal grid splitter into it's own Row and this moves the content down but it shrinks the content of the top grid which is not what I'm looking for.

Any suggestions as to waht I'm doing wrong? Is it something to do with the proportional height?

A: 

Firstly you have defined the splitter as if they apply to multiple rows and columns, but they actually have to have a row or column of their own and they apply to the adjacent rows/columns, so you were on the right track before.

The problem is the proportional (star) rows. For a splitter to work at least one of the adjacent rows/columns has to be fixed (pixel) sized or it does not adjust with the mouse but by some weird proportional movement instead.

I did not understand your "but it shrinks the content of the top grid which is not what I'm looking for" comment, so it might need some more explaining and I have made some guesses, but the XAML file shown below has the splitter behaving themselves:

 <Grid ShowGridLines="True">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="191.5"  />
            <ColumnDefinition Width="8.5"/>
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="194" />
            <RowDefinition Height="0.148*"/>
            <RowDefinition MaxHeight="25" Height="25" MinHeight="25" />
            <RowDefinition Height="0.852*"/>
        </Grid.RowDefinitions>
        <Grid Grid.RowSpan="4" Grid.Row="0" Grid.Column="0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Grid.ColumnSpan="2" Margin="0,0,-0.5,0" />
        <sdk:GridSplitter Grid.Row="0" Grid.RowSpan="4" Grid.Column="1" HorizontalAlignment="Stretch" Margin="0.5,0,-0.5,0" />
        <Frame >
        </Frame>
        <sdk:GridSplitter Grid.Row="1" HorizontalAlignment="Stretch" Grid.ColumnSpan="3" />
        <Grid Grid.Column="2" Grid.Row="3" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0.5,0,-1,0"/>
        <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Grid.Column="2" Grid.Row="3" Margin="0.5,0,-1,0">
            <Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
        </ScrollViewer>
    </Grid>
Enough already
A: 

If I understand your problem correctly. You should be able to take out the VerticalAlignment="Stretch" and HorizontalAlignment="Stretch" from your inner grid and get what you want.

The gridsplitter doesn't like other content in a different row (or col) that has both Allignments set to stretch.

Dimestore Cowboy
are you saying that there is a bug in this control?
VoodooChild
I have not investigated it enough to say for certain, but by my definition, Yes, I'll try to post various situations where the controll does not behave as expected.
Dimestore Cowboy