PropertyHasChanged MarkDirty(true) Silverlight

PropertyHasChanged MarkDirty(true) Silverlight

Old forum URL: forums.lhotka.net/forums/t/10502.aspx


AaronH posted on Thursday, July 07, 2011

When I change a property on an object on the Silverlight side, PropertyHasChanged() is invoked, but it is suppressing raising the IsDirty notification by invoking MarkDirty(true).

What is the thought behind this?

I was actually counting on binding a converter to IsDirty to show/hide something, however, changing a value on an object isn't firing the IsDirty changed event.

Am I missing something?

Thanks!

RockfordLhotka replied on Thursday, July 07, 2011

CSLA has pretty much always worked this way. PropertyChanged isn't raised for metastate property changes.

That may change in the future. The reason for this behavior is due to Windows Forms data binding, and as Windows Forms fades away, eventually I'll be able to entirely drop support for it.

AaronH replied on Friday, July 08, 2011

For anyone needing this type of behavior, I overrode OnPropertyChanged in the class that needed the behavior like so:

        protected override void OnPropertyChanged(string propertyName)
        {
            base.OnPropertyChanged(propertyName);
            base.OnPropertyChanged("IsDirty");
        }

Now I can use a converter in my binding and have it fire when IsDirty changes

Copyright (c) Marimer LLC