如何刷新数据网格的WPF [英] How to refresh datagrid in WPF

查看:265
本文介绍了如何刷新数据网格的WPF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的来源是在MySQL数据库中,我做了更新命令,现在需要刷新我的DataGrid中。

My source is in a MySQL database, i made an update command and now 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();



那么,如何刷新DataGrid的?

so, how to refresh DataGrid?

推荐答案

刷新网格的数据源更新后

Reload the datasource of your grid after the update

myGrid.ItemsSource = null;
myGrid.ItemsSource = myDataSource;

这篇关于如何刷新数据网格的WPF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆