I have a wpf form which contains a datagrid. I did put a button on my form to "Refresh" the datagrid. Steps I'm trying to get it to refresh:
I update the viewsource from my db: SupportCaseViewSource.Source = SupportCaseManager.GetAllSupportCases()开发者_StackOverflow中文版;
I refresh the datagrid items: SupportCaseDataGrid.Items.Refresh();
But nothing happens...no new data displayed!!
Has someone an idea how to do this?
Thanks
Beat
Rather than manually instructing your controls to refresh, you can implement INotifyPropertyChanged
and call PropertyChanged
with appropriate arguments. In your case this is probably
PropertyChanged(this, new PropertyChangedEventArgs("Source"));
It'll be whatever is bound to the SupportCaseDataGrid.ItemsSource
.
精彩评论