ListChanged Event

ListChanged Event

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


Bonio posted on Thursday, August 03, 2006

I am using a ListChanged event to detect changes to a childlist and to then iterate through it.

I have discovered that the ListChanged event is raised when I add an item to the collection but not when simply edit one - is this the expected behaviour?

I have a feeling the problem may lie in where I am hooking-up the event. Currently, I have the following:

_customerContactList.ListChanged += new System.ComponentModel.ListChangedEventHandler(ResetBillToShipTo);

...in the constructor of the Parent Object (an EO). I think this maybe where the problem lies.

Any suggestions please.

Thanks

 

Bonio

RockfordLhotka replied on Thursday, August 03, 2006

In version 1.53 or higher (including 2.0+), when the child object raises its IsDirtyChanged or PropertyChanged event, that should trigger the collection to raise ListChanged. Are you running one of these versions? If so, are you sure the child object is raising IsDirtyChanged (1.x) or PropertyChanged (2.x)?

Bonio replied on Thursday, August 03, 2006

Hi Rocky

Thanks for the reply.

I think the problem was due to when I was 'hooking-up' the event. I initially had it in the EO's constructor and this worked fine when the object was new but not when it was just changed. I have since moved the event 'hook-up' code to the Public property for the childlist and this is now working fine.

Thanks

Bonio

Copyright (c) Marimer LLC