views:

17

answers:

0

I am trying to make a ListView filtered, and I found it easy to achieve it. Both of those 2 methods do it perfectly:

private void ToggleHiddenReleases(bool show)
{
    ListCollectionView view;
    view = (ListCollectionView)CollectionViewSource.GetDefaultView(ListBoxAll.ItemsSource);
    if (!show) view.Filter = (mr => !((ModelRelease)mr).Hidden);
    else view.Filter = null;
    ListBoxAll.ItemsSource = view;
}

private void ToggleHiddenReleases(bool show)
{
    if (!show) ListBoxAll.Items.Filter = (mr => !((ModelRelease)mr).Hidden);
    else ListBoxAll.Items.Filter = null;
}

But I got a little problem: when I change "Hidden" field in some list item, the ListView does not reflect the changes until I toggle filter off and back on.

Is there any way to filter items while reflecting changes of filter criteria field?