如何刷新WPF中的窗口? [英] How Do I refresh window in wpf?
问题描述
我正在处理一个小项目,它是一个带有4个WPF选项卡的窗口。
I have a small project I am working on which is a window with 4 WPF tabs on it.
第一个选项卡是我完成大部分工作的地方,但有时我需要移回其他标签。这些选项卡中的一个选项卡具有一个DataGrid,该数据网格绑定到受我停留的主选项卡影响的列表。
The first tab is where I do most of the work, but occasionally I need to move back to other tabs. One of these tabs has a DataGrid that is bound to a list that is affected by the main tab I stay on.
当我在第一个选项卡上更新某些内容时,我需要
When I update something on the first tab, I need it to cause a refresh on the data in the Datagrid(usually just to update a value).
它一直起作用的唯一方法是,如果我自己单击标题,它会导致刷新Datagrid中的数据。 。
The only way it has been working is if I click on the header myself.
如何在代码中做到这一点?
How can I do this in code?
谢谢
推荐答案
列表是 ObservableCollection
还是实现 INotifyPropertyChanged
的属性?
Is the list an ObservableCollection
or properties implementing INotifyPropertyChanged
?
您是否尝试过:
myDatagrid.Items.Refresh();
这篇关于如何刷新WPF中的窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!