开发者

Refresh DataGrid in WPF

开发者 https://www.devze.com 2023-03-08 03:20 出处:网络
using WPF/C#/Entity Framework. I have a DataGrid.ItemsSource bound to some ObservableCollection. Now, I add a new item to the collection but DataGrid doesn\'t refresh. I call PropertyChanged开发者_如何

using WPF/C#/Entity Framework. I have a DataGrid.ItemsSource bound to some ObservableCollection. Now, I add a new item to the collection but DataGrid doesn't refresh. I call PropertyChanged开发者_如何学运维 as well as view.Refresh() but nothing works. Please help me.


I think the command you are looking for is Datagrid.Items.Refresh()


A common practice to refresh controls that are bound to data is using UpdateTarget() of the binding expression:

BindingOperations.GetBindingExpressionBase(myTextBox, TextBox.TextProperty).UpdateTarget();

Did you try that?

0

精彩评论

暂无评论...
验证码 换一张
取 消