Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top