I tried to use DialogResult to check an Messagebox‘s YesNoCancel. I’m using the following code which I don’t see any problem with:
DialogResult dlgResult = MessageBox.Show(
"Save changes before closing?",
"Warning",
MessageBoxButton.YesNoCancel,
MessageBoxImage.Question);
But Visual Studio throws me error saying
‘System.Windows.Window.DialogResult’
is a ‘property’ but is used like a
‘type’
There is a confliction here between the DialogResult Enumeration and the Window.DialogResult Property.
To solve this problem, you can use the fully qualified name of the enumuration. As the following:
However, since you are using WPF, use MessageBoxResult Enumeration to get the result of the message: