EntityFramework EntityState and databinding along with INotifyPropertyChanged

Posted by OffApps Cory on Stack Overflow See other posts from Stack Overflow or by OffApps Cory
Published on 2010-04-08T22:11:03Z Indexed on 2010/04/08 22:13 UTC
Read the original article Hit count: 509

Hello, all!

I have a WPF view that displays a Shipment entity. I have a textblock that contains an asterisk which will alert a user that the record is changed but unsaved. I originally hoped to bind the visibility of this (with converter) to the Shipment.EntityState property.

If value = EntityState.Modified Then
    Return Visibility.Visible
Else
    Return Visibility.Collapsed
End If

The property gets updated just fine, but the view is ignorant of the change. What I need to know is, how can I get the UI to receive notification of the property change. If this cannot be done, is there a good way of writing my own IsDirty property that handles editing retractions (i.e. if I change the value of a property, then change it back to it's original it does not get counted as an edit, and state remains Unchanged).

Any help, as always, will be greatly appreciated.

Cory

© Stack Overflow or respective owner

Related posts about wpf

Related posts about entity-framework