On a button's click, I update the list (adding rows and/or, deleting rows) that is binded to my Grid's DataSource. The newly added or removed records won't show until I do:
MyGrid.DataSource = null;
MyGrid.DataSource = (DataContext as MyViewModel).MyList;
Since I don't have access to MyGrid from the ViewModel, this code has to be in the code-behind (Click event), which is fine (Refreshing is only a UI thing). But I trigger my processing with an Interaction Trigger that is fired after the Click event. Results: the click event's refresh the DataSource, then the processing is done and not shown in the Grid.
Why is my grid not automatically updated?
Is there a way that would allow me calling my refreshing code after the trigger has been executed?
I'm using the latest version.
You do not need to implement interfaces to create a collection that will propagate changes, unless you must do so. You can use built-in collections like ObservableCollection<T>, BindingList<T> which implement all the useful interfaces and are widely used and supported.
I'm using a simple List<> .
I sort of a newbie in C#. Can you provides some easy steps to Implement the INotifyCollectionChanged interface? Just adding
public event NotifyCollectionChangedEventHandler CollectionChanged;
won't do it since the event must be fired somewhere I imagine...
Hello,
Does you collection implement INotifyCollectionChanged? What type of collection are you using?