In Windows Forms programming, I have this general problem. When the page is loading and populating, in some cases I don't want the logic in the event handlers to run.
The event handling code is primarily to respond to user interaction, but it also runs when the controls are manipulated programmatically. In the past, I've seen people use an IsLoading boolean to protect logic that should only occur in response to user input. This strikes me as a little inelegant, and also the developer has to remember to put it everywhere; this is especially an issue when new features are added.
Lately I've been writing methods to disconnect the event handlers when loading the form, and reconnect them (in a finally clause) afterward. This seems a little better, but I wonder if there is a more elegant way. Anyone have an alternate way of handling this situation?