Hi,
I'm using the ModernDialog that contains a UserControl, it has a custom button:
Button customButtonClose = new Button() { Content = "Close" };
customButtonClose.Click += (ss, ee) =>
{
CheckPendingChanges();
dialog.Close();
};
dialog.Buttons = new Button[] { customButtonSave, customButtonClose };
In CheckPendingChanges():
var rsltDialog = Utils.ShowMessageYesNoClose("Are there a pending changes, save?");
if (rsltDialog == MessageBoxResult.Yes)
{
result = customFunction();
}
where Utils.ShowMessageYesNoClose() is:
public static MessageBoxResult ShowMessageYesNoClose(string text)
{
var dlg = new ModernDialog
{
Title = (string)Application.Current.FindResource("mdAppTitle"),
Content = new BBCodeBlock { BBCode = text, Margin = new Thickness(0, 0, 0, 8) },
MinHeight = 0,
MinWidth = 0,
MaxHeight = 480,
MaxWidth = 640,
};
dlg.YesButton.Content = (string)Application.Current.FindResource("msgBoxResultYes");
dlg.NoButton.Content = (string)Application.Current.FindResource("msgBoxResultNo");
dlg.Buttons = new[] { dlg.YesButton, dlg.NoButton, customCancelClose, dlg.CancelButton };
dlg.ShowDialog();
return dlg.MessageBoxResult;
}
I have this problem: when I click on CancelButton, the two windows are closing together, but I would close only second window, the one with the application.
Where is the error?