'Binding DataGrid ItemSource to CollectionView does not work
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.
Solution 1:[1]
If you have a List of type BlInvoices (List<BlInvoices>) called BlInvoicesCollection, then you can simply use:
dataGrid.ItemsSource = BlInvoicesCollection;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Peter Csala |
