Elegant solution for dialog conditioning

Good dialogs should only show appropriate options. For example Power Management settings should only be available when Power Management is enabled, or when Power Management is selected to be enabled when the dialog is closed.

Data binding provides us with a elegant solution for such dialog conditioning. Simply place all conditional controls (in this case power management settings controls) in to a panel (pnlPMSetting). Data bind the Enabled property of the panel to the Checked property of the enabler control (ckUsePM).

pnlPMSettings.DataBindings.Add(“Enabled”, ckUsePM, “Checked”);

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: