WPF ListView scrollable height
-
I am using the WPF ListView, with an embedded GridView, to display a table of data. When the scroll bar is present, I would like to slightly increase the scrollable height of the list, making a little more visible white space at the end of the list. Note, I do NOT want to accomplish this by adding additional empty rows to the list. Any ideas on how to accomplish this? Thanks, Aaron Stibich
-
I am using the WPF ListView, with an embedded GridView, to display a table of data. When the scroll bar is present, I would like to slightly increase the scrollable height of the list, making a little more visible white space at the end of the list. Note, I do NOT want to accomplish this by adding additional empty rows to the list. Any ideas on how to accomplish this? Thanks, Aaron Stibich
There may be better method, but I think this should work : You can create a ListViewItem template, so when it's last item (specify in your underlying model, or use TemplateSelector), occupy more space but not focusable. Something like the following :
<DataTemplate x:Key="NormalColumn1Template" >
<TextBlock Text="{Binding Text}" />
</DataTemplate><DataTemplate x:Key="LastColumn1Template" >
<StackPanel Orientation="Vertical">
<TextBlock Text="{Binding Text}" />
<TextBlock Text="FreeSpace" Height="100" IsHitTestVisible="False" IsFocusable="False" Background="White" />
</StackPanel>
</DataTemplate>Regards Joseph Leung