简体   繁体   中英

Refresh DataGrid in WPF

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM