I want to bind a datagrid.itemsource to a List with anonymous type,so i bind it to a collectionViewSource,but i need to add or remove an item to the list,but i don't know how?
相关问题
- how to split a list into a given number of sub-lis
- VNC control for WPF application
- C#: How do i get 2 lists into one 2-tuple list in
- F#: Storing and mapping a list of functions
- Select first row from multiple dataframe and bind
CollectionView
andCollectionViewSource
are, as their name suggest, only views. You can only manipulate the original collection. You should use anObservableCollection
if you want the changes to be automatically reflected in your UI.I would advise against using anonymous types for data binding. But if you must - they implement the Equals method, so you should be able to remove items using new items with equal properties or using the item's index.