I am working on a small WPF project and need to bind a CollectionView to a DataGrid. Therefore, I call the following command in a method to set the CollectionView's data:
BlInvoicesCollectionView = (CollectionView)CollectionViewSource.GetDefaultView(BlInvoices);
BlInvoicesCollectionView.Filter = FilterBlInvoices;
BlInvoices is just a normal list with items of a model I created. When I debung the code, the CollectionView contains the values it should. However, the Items are not displayed in the DataGrid and I couldn't figure out why yet.
Solved my issue by implementing a new property of type CollectionView, which is calls the PropertyChanged everytime it is set.
public CollectionView BlInvoicesCollectionView { get{ return blInvoicesCollectionView; }
set { blInvoicesCollectionView = value; OnPropertyChanged(nameof(BlInvoicesCollectionView)); } }