dahall / AeroWizard

Library for easy creation of custom and Aero Wizards. Aero Wizard strictly follows Microsoft guidelines and uses Visual Styles to get visual theming.
MIT License
114 stars 31 forks source link

Commit b3276e3 makes Cancel button stop working #96

Open boz70 opened 1 year ago

boz70 commented 1 year ago

Commit b3276e3 inverts the logic of the Cancelling event's CancelEventArgs.Cancel property. Cancel = true now behaves as documented for System.ComponentModel.CancelEventArgs: it cancels the Cancelling operation which results in ignoring the user's cancel action (pressing the button). This is a breaking change to existing code handling the Cancelling event starting with V2.2.8. What makes it worse is the fact that the Cancel property is still initialized with true which makes the Cancel button being ignored.

As a fix the CancelEventArgs.Cancel property should be initialized with false so that by default the Cancel button closes the wizard.

A workaround is handling the Cancelling event and resetting the Cancel property

private void wizardCtrl_Cancelling(Object sender, System.ComponentModel.CancelEventArgs e)
{
    e.Cancel = false;
}

or revert to V2.2.7.