I have created a WinForms user control that is a set of five cascading combo boxes - the user selects something from the top combo which then populates and enables the second combo, and so on. If there is only one option in the newly enabled combo I automatically select it, causing the one below it to become active. Consequently a single user action can ripple down through several additional combos.
I raise an event specific to each combo box. I also want to raise a final event any time anything changes. For example, the user selects an option from the top combo. This raises the Combo1Changed event. If this automatically causes a selection in the second combo then I would also raise a Combo2Changed event. When it's all done I want to raise a single SomethingChanged event.
Right now I raise the ComboXChanged and the SomethingChanged events every time a combo changes. But since a single selection can cascade down all five combos it can potentially cause dozens of events to be raised.
I can't figure out how to determine when the cascading has finished, so that I can fire the events just once. Is there a clever trick or pattern for coding this kind of thing?