I have a problem with the grids grid that takes my list out of view in this combination. Steps to play:
- Run the program, drag the window size larger
- Drag the red splitter all the way to minimize the blue column
- Extend both ListView columns until they are outside the viewport and a horizontal scroll appears.
- Drag window size again
For me, this slowly pops the ListView out of the window. Note that ScrollViewer actually reduces the size with Window, but not at the same speed and slowly out of sight. As soon as the scrollviewer starts to exit view mode, the splitter can no longer be used!
Oddly enough, if I do not minimize the left panel first, I do not get this behavior!
What will this fix be?
<Window x:Class="LayoutTest3.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="600" Width="800" MinHeight="600" MinWidth="800" > <Window.Resources> <XmlDataProvider XPath="/Celebrities/Celebrity" x:Key="celebs"> <x:XData> <Celebrities xmlns=""> <Celebrity Name="Jimmy"> <LastName>Page</LastName> </Celebrity> <Celebrity Name="Johnny"> <LastName>Depp</LastName> </Celebrity> <Celebrity Name="Britney"> <LastName>Spears</LastName> </Celebrity> </Celebrities> </x:XData> </XmlDataProvider> <DataTemplate x:Key="NameTemplate"> <TextBlock Text="{Binding XPath=@Name }" /> </DataTemplate> </Window.Resources> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" MinWidth="100" /> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="*" MinWidth="400" /> </Grid.ColumnDefinitions> <Border Grid.Column="0" Background="Blue" /> <GridSplitter Grid.Column="1" Width="5" HorizontalAlignment="Center" ResizeBehavior="PreviousAndNext" VerticalAlignment="Stretch" Background="Red" /> <Border Grid.Column="2" Background="Green"> <ListView ItemsSource="{Binding Source={StaticResource celebs}}"> <ListView.View> <GridView> <GridView.Columns> <GridViewColumn Header="Name" CellTemplate="{StaticResource NameTemplate}" Width="150" /> <GridViewColumn Header="LastName" DisplayMemberBinding="{Binding XPath=LastName}" /> </GridView.Columns> </GridView> </ListView.View> </ListView> </Border> </Grid> </Window>
source share