C #: How to effectively filter (hide) ListView items in virtual mode?

C #: How to effectively filter (hide) ListView items in virtual mode?

I am looking for a way to filter (hide / show) items in a ListView in virtual mode. I have my items cached in an array of list items, how can I effectively make sure that only specific list items are displayed when the filter button is pressed, and then all of them returned when the non-filter button is clicked?

+3
source share
2 answers

You will need to display a list of visible lines, so when RetrieveVirtualItem requests an element, it requests in your filtered list, which contains only visible elements.

CacheVirtualItems ListViewItems, , . , .

+2

, FilterResult , ListView. , ListView, DataTrigger FilterResult Setter on Visibility, :

<DataTrigger Binding="{Binding FilterResult}" Value="False">
           <Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>

, , Shown, FilterResult ( PropertyChanged Notifying) !: =)

, - FilterResult, NotificationCollection, , , FilterResult . , CollectionChanged, FilterResult...

0

Source: https://habr.com/ru/post/1710282/


All Articles