How to "re-raise" an event?

How to "re-raise" an event?

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


MadGerbil posted on Tuesday, June 01, 2010

In some of my objects I capture the OnPropertyChanged event so that I can create a log note about changes to the object.   For most properties this works out really well; however, in situations where there is a dependent property it doesn't work out so great.   What happens is that the error provider on dependent properties don't get updated.  (The red '!' circles don't disappear when the rule is no longer broken).

protected override void OnPropertyChanged([insert parameters here])

If I comment out this override in a business object the dependent properties' error provider updates everything on the screen very nicely.  I'm guessing what is happening is that by capturing the OnPropertyChanged event I'm not allowing the UI to capture it thereby triggering the proper updates to the error provider.

Is there a way to 're-raise' the event to make it look as if I didn't capture it?

RockfordLhotka replied on Tuesday, June 01, 2010

In your override, call the base method:

base.OnPropertyChanged(...);

 

MadGerbil replied on Wednesday, June 02, 2010

Works wonders!

I've a wonderfully responsive UI and logging of changes to the object.

BTW, the rule handling in CSLA is a dream come true.   We are implementing a new financial system here and my applications have to be updated to work with about 50 new rules.   Instead of digging through mounds of code I can rather easily add these complex rules and have it all work with minimal changes to the code.  What a life saver.

Many thanks!!!!!!!!!!!

Copyright (c) Marimer LLC