Ok, I give up - how do I get the vertical scroll bars to appear on a list view without specifing a hard coded value for the MaxHeight in the xaml?
here is my xaml (i've not included the data model, but it's basically a directory listing)
<UserControl x:Class="WpfApplication1.Views.FolderViewView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="500" >
<DockPanel>
<StackPanel DockPanel.Dock="Top">
<Label Name="lblFolder" Content="{Binding Path=FolderName}" MinWidth="250"/>
<Button Name="btnFolder" Content="Select Folder" Click="btnFolder_Click" />
</StackPanel>
<DockPanel>
<ListView Name="lstFiles" ItemsSource="{Binding}" Margin="1" MaxHeight="200" Height="Auto" ScrollViewer.CanContentScroll="True" ScrollViewer.VerticalScrollBarVisibility="Auto" >
<ListView.View>
<GridView>
<GridViewColumn Header="Filename" DisplayMemberBinding="{Binding Path=FileName}" />
<GridViewColumn Header="Extenstion" DisplayMemberBinding="{Binding Path=Extension}" />
<GridViewColumn Header="Size" DisplayMemberBinding="{Binding Path=FileSize}" />
<GridViewColumn Header="Creation Date" DisplayMemberBinding="{Binding Path=CreateDate}" />
<GridViewColumn Header="Modified Date" DisplayMemberBinding="{Binding Path=ModifiedDate}" />
</GridView>
</ListView.View>
</ListView>
</DockPanel>
</DockPanel>
Without setting MaxHeight on the ListView control, the scroll bar does not appear when there are enough items to make the List view larger than the screen. With MaxHeigt="250", the scroll bar appears, but now the list view doesn't extend when the user changes the size of the window.
Maybe I'm asking the wrong question and it should be: How do I change the max height of the listview when the height of the window is changed?
Please help, this has been driving me up the wall for the last day now...
Thanks
Lee