Parent - Child Changed Event

Parent - Child Changed Event

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


xAvailx posted on Thursday, April 30, 2009

CSLA 3.5.1

I know this has been discussed many times, found many useful posts, but having trouble implementing with a scenario.

Parent > Child Collection > Child

I have logic in the parent that depends on which child object was added/removed. So basically, I need to know which specific child object was added/removed.

I am overriding the OnChildChanged event on the parent, but the event args don't tell give me a reference to the item that was just added/removed.

Before I go in an add a new event, wanted to check if this was possible with the current CSLA events.

Thx.

RockfordLhotka replied on Thursday, April 30, 2009

The ChildChanged event has been revised substantially in 3.6, and I'm pretty sure you can get the original sender (the original child object) and the original EventArgs (PropertyChangedEventArgs or ListChangedEventArgs) in the event handler.

xAvailx replied on Friday, May 01, 2009

Thx Rocky.

Actually, I just checked and we are on 3.6.1, sorry for the confusion.

On the parent object, this is what the ChildChangedEventArgs contains:

ChildObject - Child Collection with current items
ListChangedArgs - ListChangedType, NewIndex, OldIndex
PropertyChangedArgs - Null





Copyright (c) Marimer LLC