WindowBehavior ClassDW.WPFToolkit Documentation
Brings the feature to a Window to bind loading and closing action or easy close with dialog result.
Inheritance Hierarchy

SystemObject
  System.Windows.ThreadingDispatcherObject
    System.WindowsDependencyObject
      DW.WPFToolkit.InteractivityWindowBehavior

Namespace: DW.WPFToolkit.Interactivity
Assembly: DW.WPFToolkit (in DW.WPFToolkit.dll) Version: 5.6.0.0
Syntax

C#
public class WindowBehavior : DependencyObject

The WindowBehavior type exposes the following members.

Constructors

  NameDescription
Public methodWindowBehavior
Initializes a new instance of the WindowBehavior class
Top
Methods

  NameDescription
Public methodStatic memberGetClosedCommand
Gets the command from a window which get called when the window has been closed. A WindowClosingArgs is passed as a parameter to change the dialog result and cancel the close.
Public methodStatic memberGetClosingCommand
Gets the command from a window which get called when the window closes. A WindowClosingArgs is passed as a parameter to change the dialog result and cancel the close.
Public methodStatic memberGetDialogResult
Gets the dialog result from a button to be called on the owner window.
Public methodStatic memberGetDialogResultCommand
Gets the dialog result command from a button to get the dialog result called on the owner window.
Public methodStatic memberGetIsClose
Gets a value from a button that indicates that the window have to be closed when the button is pressed without using the dialog result.
Public methodStatic memberGetLoadedCommand
Gets the command from a window which get called when the window is loaded.
Public methodStatic memberGetLoadedCommandParameter
Gets the command parameter from a window which is passed by the DW.WPFToolkit.Interactivity.WindowBehavior.LoadedCommand.
Public methodStatic memberGetWinApiCommand
Gets a command which get called if one of the message attached by the DW.WPFToolkit.Interactivity.WindowBehavior.WinApiMessages occurs.
Public methodStatic memberGetWinApiMessages
Gets a list of hex values of a WinAPI messages to listen and forwarded to the DW.WPFToolkit.Interactivity.WindowBehavior.WinApiCommand.
Public methodStatic memberSetClosedCommand
Attaches the command to a window which get called when the window closes.
Public methodStatic memberSetClosingCommand
Attaches the command to a window which get called when the window closes. A WindowClosingArgs is passed as a parameter to change the dialog result and cancel the close.
Public methodStatic memberSetDialogResult
Attaches the dialog result to a button to be called on the owner window.
Public methodStatic memberSetDialogResultCommand
Attaches the dialog result command to a button to get the dialog result called on the owner window.
Public methodStatic memberSetIsClose
Attaches a value from a button that indicates that the window have to be closed when the button is pressed without using the dialog result.
Public methodStatic memberSetLoadedCommand
Attaches the command to a window which get called when the window is loaded.
Public methodStatic memberSetLoadedCommandParameter
Attaches the command parameter from a window which is passed by the DW.WPFToolkit.Interactivity.WindowBehavior.LoadedCommand.
Public methodStatic memberSetWinApiCommand
Attaches a command which get called if one of the message attached by the DW.WPFToolkit.Interactivity.WindowBehavior.WinApiMessages occurs.
Public methodStatic memberSetWinApiMessages
Attaches a list of hex values of a WinAPI messages to listen and forwarded to the DW.WPFToolkit.Interactivity.WindowBehavior.WinApiCommand.
Top
Fields

  NameDescription
Public fieldStatic memberClosedCommandProperty
Public fieldStatic memberClosingCommandProperty
Public fieldStatic memberDialogResultCommandProperty
Public fieldStatic memberDialogResultProperty
Public fieldStatic memberIsCloseProperty
Public fieldStatic memberLoadedCommandParameterProperty
Public fieldStatic memberLoadedCommandProperty
Public fieldStatic memberWinApiCommandProperty
Public fieldStatic memberWinApiMessagesProperty
Top
Attached Properties

  NameDescription
Public attached propertyClosedCommand
Public attached propertyClosingCommand
Public attached propertyDialogResult
Public attached propertyDialogResultCommand
Public attached propertyIsClose
Public attached propertyLoadedCommand
Public attached propertyLoadedCommandParameter
Public attached propertyWinApiCommand
Public attached propertyWinApiMessages
Top
Examples

public class MainViewModel : ObservableObject
{
    public MainViewModel()
    {
        TryCloseCommand = new DelegateCommand<WindowClosingArgs>(TryClose);
    }

    public DelegateCommand<WindowClosingArgs> TryCloseCommand { get; private set; }

    private void TryClose(WindowClosingArgs e)
    {
        // Ask user if really close
        e.Cancel = true;

        //e.DialogResult = false;
    }
}
See Also

Reference