开发者

DataGrid.ItemsSource.Refresh() not working

开发者 https://www.devze.com 2023-01-19 11:11 出处:网络
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 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:

  1. I update the viewsource from my db: SupportCaseViewSource.Source = SupportCaseManager.GetAllSupportCases()开发者_StackOverflow中文版;

  2. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消