Hi all,
I want to enable close button of message box window .I am trying this code but close button is not enable.
if (MessageBox.Show("Do you want to close this window?", "Confirmation", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{
// Close the window
}
else
{
// Do not close the window
}
Thanks
Aniruddha
VulpesPosted Dec 24, 2012, 9:58 AM
If the user clicks the Close button, the Cancel button will then be deemed to have been pressed by default.
However, there's no way to keep the MessageBox open after the user has pressed a button - and, even if there was, I can't see why you'd want to.
Sivaraman DhamodaranPosted Dec 24, 2012, 7:30 AM
Displaying the same message box with MessageBoxButton.Yes will enabled the close button
venkata kumarPosted Dec 24, 2012, 6:52 AM
try this
DialogResult dialog = MessageBox.Show("Do You Want To Continue?", "", MessageBoxButtons.YesNo,MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
if (dialog == DialogResult.Yes)
{
}
else if (dialog == DialogResult.No)
{
}