DataGrid's ItemsSource is highlighted to ICollectionView type properties, and record additions pass the child window parameters to the model's method to add them.I can add it to the database without any problems, but when I add it, I don't know how to update the display of DataGrid.
DataGrid properties after adding records are in ViewModel in the parent window, so I have changed them from ViewModel in the child window for addition.
This is a restriction that no code behind-the-scenes coding is required, so I asked you what kind of configuration (processing flow) it should be better from the perspective of the mvvm pattern.
*Livet is used for the framework.
c# wpf mvvm
By implementing INotifyCollectionChanged in the list bound to DataGrid, DataGrid can be updated when added or deleted.
ObservableCollection is standard.
https://msdn.microsoft.com/ja-jp/library/ms668604(v=vs.110).aspx
ICollectionView
is not updated unless you invoke the Refresh
method.
An implementation that often registers a handler calling ICollectionView.Refresh
in the ObservableCollection
event under ICollectionView
.
© 2024 OneMinuteCode. All rights reserved.