Horizontal scrollbar in empty listview disappears
-
Hi, I have a listview as below:
<Window x:Class="Practice.WPF.ListViewTest" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="ListViewTest" Height="300" Width="75" Closed="Window_Closed"> <ListView x:Name="listView" ScrollViewer.IsDeferredScrollingEnabled="True" VirtualizingStackPanel.IsVirtualizing="True"> <ListView.View > <GridView > <GridViewColumn Header="Id" DisplayMemberBinding="{Binding Path=Id}"></GridViewColumn> <GridViewColumn Header="Name" DisplayMemberBinding="{Binding Path=Name}"></GridViewColumn> <GridViewColumn Header="Price" DisplayMemberBinding="{Binding Path=Price}"></GridViewColumn> <GridViewColumn Header="Date" DisplayMemberBinding="{Binding Path=Date}"> </GridViewColumn> <GridViewColumn Header="Quantity" DisplayMemberBinding="{Binding Path=Quantity}"></GridViewColumn> </GridView> </ListView.View> </ListView> </Grid> </Window>
The problem is when there is no data bound to the listview the horizontal scrollbar disappears, and the Headers get cut off. I want the horizontal scrollbar to be still visible. (My requirement may sound weird, but i want this functionality for a listview which displays streaming numerical data and has filters on column headers. Sometimes the filter condition does not satisfy any of the rows so the listview becomes empty and horizontal scrollbar disappears. Now some of the columns will get cut off and the user cannot scroll to that column and clear the filter.) ANy ideas how i achieve this.Pankaj Chamria, Software Programmer.
-
Hi, I have a listview as below:
<Window x:Class="Practice.WPF.ListViewTest" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="ListViewTest" Height="300" Width="75" Closed="Window_Closed"> <ListView x:Name="listView" ScrollViewer.IsDeferredScrollingEnabled="True" VirtualizingStackPanel.IsVirtualizing="True"> <ListView.View > <GridView > <GridViewColumn Header="Id" DisplayMemberBinding="{Binding Path=Id}"></GridViewColumn> <GridViewColumn Header="Name" DisplayMemberBinding="{Binding Path=Name}"></GridViewColumn> <GridViewColumn Header="Price" DisplayMemberBinding="{Binding Path=Price}"></GridViewColumn> <GridViewColumn Header="Date" DisplayMemberBinding="{Binding Path=Date}"> </GridViewColumn> <GridViewColumn Header="Quantity" DisplayMemberBinding="{Binding Path=Quantity}"></GridViewColumn> </GridView> </ListView.View> </ListView> </Grid> </Window>
The problem is when there is no data bound to the listview the horizontal scrollbar disappears, and the Headers get cut off. I want the horizontal scrollbar to be still visible. (My requirement may sound weird, but i want this functionality for a listview which displays streaming numerical data and has filters on column headers. Sometimes the filter condition does not satisfy any of the rows so the listview becomes empty and horizontal scrollbar disappears. Now some of the columns will get cut off and the user cannot scroll to that column and clear the filter.) ANy ideas how i achieve this.Pankaj Chamria, Software Programmer.
-
Thanks for your reply. I looked at the Link. However the solution of having two scrollbars for header and content is an overkill and quite complex [at least for a beginner like me:)]. I have handled the problem by allowing the user to reset all the filters using a workaround, to get back the data and with it the scrollbars.
Pankaj Chamria, Software Programmer.
-
Thanks for your reply. I looked at the Link. However the solution of having two scrollbars for header and content is an overkill and quite complex [at least for a beginner like me:)]. I have handled the problem by allowing the user to reset all the filters using a workaround, to get back the data and with it the scrollbars.
Pankaj Chamria, Software Programmer.