WPF GridSplitter makes my Grid wider than my Window!
I’ve got a WPF Grid with a GridSplitter. If I resize my columns, then I can make my grid wider than my window and non-viewable.
It starts like this:
WPF Grid http://img201.imageshack.us/img201/9505/onehg6.jpg
But after widening the left column, I can no longer see the right column (green):
WPF GridSplitter http://img201.imageshack.us/img201/1804/twomy6.jpg
What am I doing wrong? How do I keep the GridSplitter from changing the size of my Grid?
Update:
I’m still struggling with this. I’ve now tried nesting grids within grids. That didn’t help. Here’s my XAML ColumnDefinitions, RowDefinitions, and GridSplitters…
<Window ... > <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width='*' MinWidth='150' /> <ColumnDefinition Width='Auto' /> <ColumnDefinition Width='*' MinWidth='400' /> </Grid.ColumnDefinitions> <GridSplitter ResizeDirection='Columns' ResizeBehavior='BasedOnAlignment' Grid.Column='1' HorizontalAlignment='Center' VerticalAlignment='Stretch' Width='2' Margin='0,5,0,5' Panel.ZIndex='1'/> <Grid Grid.Column='0'> ... </Grid> <Grid Grid.Column='2'> <Grid.ColumnDefinitions> <ColumnDefinition Width='*' MinWidth='150' /> <ColumnDefinition Width='Auto' /> <ColumnDefinition Width='*' MinWidth='200' /> </Grid.ColumnDefinitions> <GridSplitter ResizeDirection='Columns' ResizeBehavior='PreviousAndNext' Grid.Column='1' HorizontalAlignment='Center' VerticalAlignment='Stretch' Width='2' Margin='0,5,0,5' Panel.ZIndex='1'/> <Grid Grid.Column='0'> ... </Grid> <Grid Grid.Column='2'> ... </Grid> </Grid> </Grid> </Window>
Update:
I think the problem is with the WebBrowser control. See new question:
If your
Windowis resized so itsWidthis less than the sum of your columns’MinWidth, you’ll see the columns cut off, but otherwise I can’t reproduce your problem:Expanding the red column, it will only expand until the right column reaches its
MinWidthof 400, it won’t boot it off the page.It’s possible you’re setting other properties of the
Windowor the outermostGridthat would cause this behavior…