WPF entity infrastructure binding not updating

I have a binding that is bound to an object defined by the entity infrastructure. Some of my bindings update normally, while others do not. The best way to explain is an example, I have something like this:

<TextBlock Text="{Binding Path=FirstName}"/>
<TextBlock Text="{Binding Path=LastName}"/>
<TextBlock Text="{Binding Path=Role.Name}"/>

In this case, the text in the first 2 text blocks is updated as soon as the property of the object is changed. In the case of the latter, nothing happens. I understand why this is happening. The framework entity has a RoleID property, which is updated, and it raises a property change event for RoleID, but afaik does not create such an event for the role. Therefore, the binding does not know that something has changed. Possible solutions that I see are to force the entity infrastructure to raise the changed property event for the role when the RoleID changes, or get a binding to look for changes in the RoleID instead of the role. I am not sure how to do this.

Thanks in advance for any answers, Michael

+3
source share
2 answers

. , , . , entity RoleID, . , ReportPropertyChanged, , , . OnPropertyChanged ( "" ) ReportPropertyChanged. , RoleID . -

partial void OnRoleIDChanged()
{
    OnPropertyChanged("Role");
}
+3

, :

  • INotifyPropertyChanged, .

  • UpdateSourceTrigger = PropertyChanged , ( ).

, .

+1

All Articles