My source is in a MySQL database, I\'ve made an update command and now I need to refresh my DataGrid
.
MySqlCommand cmd = new MySqlCommand(
\"u
Reload the datasource of your grid after the update
myGrid.ItemsSource = null;
myGrid.ItemsSource = myDataSource;
Try mydatagrid.Items.Refresh()
Bind you Datagrid to an ObservableCollection, and update your collection instead.
I had a lot of trouble with this and this is what helped me get the DataGrid reloaded with the new values. Make sure you use the data type that your are getting the data from to get the latest data values.
I represented that with SomeDataType
below.
DataContext.Refresh(RefreshMode.OverwriteCurrentValues, DataContext.SomeDataType);
Hope this helps someone with the same issues I had.
From MSDN -
CollectionViewSource.GetDefaultView(myGrid.ItemsSource).Refresh();
How about
mydatagrid.UpdateLayout();