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( "update request set status = " + StatusRequest(value) + " where id = " + rowView[0].ToString() + "", conn); MySqlDataReader myReader = cmd.ExecuteReader();
How do I refresh my DataGrid
?
Set your data item to ObservableCollection and bind itemSource of dataGrid with ObservableCollection . Datagrid will be refreshed if entries will be added/removed or moved to this collection.
Use the dataGrid. refresh method. Use the reload() method of your DataGrid's dataSource as shown in the following help topic: cacheEnabled. Create a new instance of a store and assign it to your DataGrid's dataSource.
Try mydatagrid.Items.Refresh()
Reload the datasource of your grid after the update
myGrid.ItemsSource = null; myGrid.ItemsSource = myDataSource;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With