WPF ListViewItem IsSelected only affect after scroll in view
I have a binding for ListViewItem, which is under gridview/listview/scrollviewer.
<Setter Property="IsSelected" Value="{Binding IsSelected}"/>
There's one problem occurred to me:
After I press "CTRL+A" in a ListView/GridView, all items that are currently in the ScrollViewer area will have "IsSelected" set to true.
For all other items in the list, but NOT in the current viewable area of the scroll viewer, the "IsSelected" will NOT be set to "true" unless I scroll them into viewable area manually开发者_Python百科.
I want to ask is this by design? If not, what I may go wrong?
Thank you.
You are probably using virtualization. So only the "containers" (i.e. ListViewItem) needed to fill the view will be created. You can disable virtualization by setting VirtualizingStackPanel.IsVirtualizing to false on your ListView. This does have a performance hit if you have a lot of data though.
精彩评论