Wpf binding is funny for those who know it well and it is nightmare for newbie.
If I bind a combobox to the commented out CollectionView the control shows all the elements, including those excluded by the filter. If I bind the same combobox to a ICollectionView it displays only the filtered elements and it is Ok.
//public CollectionView MyCapitoliList { get; private set; }
public ICollectionView MyCapitoliList { get; private set; }
Here is the code I use to create the CollectionView and ICollectionView
MyCapitoliList = CollectionViewSource.GetDefaultView(listaCapitoli);
//MyCapitoliList = new CollectionView(listaCapitoli);
MyCapitoliList.Filter = new Predicate<object>(isCapitoloMaster);
I checked the CollectionView printing all its elements from C# code and it contains only the filtered elements, so the CollectionView is Ok.
Why do I get all the unfiltered elements if I bind it to a combobox ?
Thanks
Filippo
MSDN says about
CollectionViewclass…It further adds …