IsModified oddities: Removing an item from a BusinessListBase

IsModified oddities: Removing an item from a BusinessListBase

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


dagware posted on Monday, July 30, 2012

I've come across a peculiar situation (CSLA 4.3.13, WPF 4). Let's say I have a parent BusinessBase with children. We've just loaded the parent from the database, and IsModified is false.

We modify a child. Now the parent's IsModified is true, as it should be.

We remove the child. During this process, the parent's IsModified goes back to false, then back to true. I first noticed this because I have a "Save" button that uses animation to fade it out and back in, depending on IsModified. So in this situation, you can see the button go away and then fade back in, quickly.

Is there a good way to handle this? Some sort of way to keep IsModified returning true, during the process of removing the child item?

Thanks.

Dan

JonnyBee replied on Monday, July 30, 2012

Hi,

There's nothing called IsModified in CSLA. Is this your own implemented property or are you referring to the IsDirty flag?

dagware replied on Monday, July 30, 2012

Sorry - I meant IsDirty. One of those days...

JonnyBee replied on Monday, July 30, 2012

And I assume that you use Csla.Xaml.ViewModelBase to make the property bindable?
(Properties like IsDirty, IsSelfDirty, IsValid will become bindable directly on the objects in Csla 4.5 with OnPropertyChanged events).

Csla.Xaml.ViewModelBase hooks into several events on the business objects in order to update all the bindable "metastate" properties. It could be that this is not the optimum solution for the IsDirty flag but it is the best we can do at the moment.

dagware replied on Monday, July 30, 2012

Hard to argue with that! :)

Thanks.

dagware replied on Wednesday, August 01, 2012

This shouldn't come as a surprise for anyone who knows me, but it turns out that I'm an idiot. I was the one who was causing the problem. Story of my life!

Dan

Copyright (c) Marimer LLC