我将WPF DataGrid中特定行的DataContext设置为另一个对象。 DataContext已更改(在Watch窗口中看到),但各种绑定列不反映该行的已更改DataContext。
这是我的代码:
Private Sub btnDataContextChange_Click(sender As Object, e As RoutedEventArgs) Handles btnDataContextChange.Click
Dim row = dtgChildren.FindVisualChild(Of DataGridRow)()
row.DataContext = DBEntities.Persons.Single(Function(x) x.PersonID = 22)
End Sub
如何强制刷新绑定?