Gets or sets the dialog result value, which is the value that is returned from the ShowDialog method.
Assembly: PresentationFramework (in PresentationFramework.dll)
can be used from the code that showed a dialog box to determine whether a user accepted (true) or canceled (false) the dialog box. If a dialog box was accepted, this signifies to the code that opened the dialog box to retrieve the data that was collected by the user and process it. If a dialog box was canceled, however, this signifies that calling code should stop any further processing.
By default, a dialog box is canceled when a user does one of the following:
Clicks the Close button.
Selects Close from the System menu.
In all of these cases, is false by default.
A dialog box typically provides a special button to cancel a dialog, which is the button whose IsCancel property is set to true. A button configured this way will automatically close a window when either it is pressed, or when the ESC key is pressed. In either of these cases, remains false.
A dialog box also typically provides an accept button, which is the button whose IsDefault property is set to true. A button configured this way will raise its Click event when either it or the ENTER key is pressed. However, it won't automatically close the dialog box, nor will it set to true. You need to manually write this code, usually from the Click event handler for the default button.
is a null reference (Nothing in Visual Basic) when the dialog box is shown but neither accepted nor canceled.
After a dialog box closes, you can get the dialog result from the value returned by ShowDialog method, or by inspecting the property.
You cannot set or get this property when a window is hosted in a browser.
The following example shows how to configure an OK button and a Cancel button to return the appropriate .