Cartesius00
Cartesius00

Reputation: 24414

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.

Upvotes: 0

Views: 5237

Answers (2)

Amir Gonnen
Amir Gonnen

Reputation: 3727

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?

Upvotes: 0

IndigoDelta
IndigoDelta

Reputation: 1481

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

Upvotes: 1

Related Questions