TaskDialog default button

1.1k views Asked by At

stackoverflow just works faster :)
I'm using the Windows® API Code Pack for Microsoft® .NET Framework to access Windows 7 API and I want to change my old MessageBox to TaskDialog. One thing I cannot find is the default button of the dialog. Is there a way to set it? what about a work around?

thanks

1

There are 1 answers

0
Kate Gregory On BEST ANSWER

There is a Default property on a control under the taskbased dialog you can set to true. From the sample (Samples\TaskDialogDemo\CS\TaskDialogDemo) that ships with it:

TaskDialog tdEnableDisable = new TaskDialog();
tdEnableDisable.Cancelable = true;
tdEnableDisable.Caption = "Enable/Disable Sample";
tdEnableDisable.InstructionText = "Click on the buttons to enable or disable the radiobutton.";

enableButton = new TaskDialogButton("enableButton", "Enable");
enableButton.Default = true;
enableButton.Click += new EventHandler(enableButton_Click);

If you run the demo, click Enable/Disable sample and then press Enter a few times you will see that the two buttons take turns being the default.