views:

27

answers:

1

Hi

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();

  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

A: 

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.

Lunivore