In System.Windows.Forms.Button there is a property DialogResult, where is this property in the System.Windows.Controls.Button (WPF)?
相关问题
- VNC control for WPF application
- WPF Binding from System.Windows.SystemParameters.P
- XAML: Applying styles to nested controls
- How can I add a horizontal line (“goal line”) for
- How to properly change a resource dictionary
There is no
Button.DialogResult
in WPF. You just have to set theDialogResult
of theWindow
to true or false :Just make sure that you've shown the form using
ShowDialog
rather thanShow
. If you do the latter you'll get the following exception raised:There is no built-in Button.DialogResult, but you can create your own (if you like) using a simple attached property:
This will allow you to write:
and get behavior equivalent to WinForms (clicking on the button causes the dialog to close and return the specified result)