Intersoft ClientUI Documentation
Closing Event
See Also  Example Send Feedback
Intersoft.Client.UI.Aqua.UXDesktop Namespace > UXWindow Class : Closing Event






Occurs when a window is about to close.

Syntax

Visual Basic (Declaration) 
Public Event Closing As WindowEventHandler
Visual Basic (Usage)Copy Code
Dim instance As UXWindow
Dim handler As WindowEventHandler
 
AddHandler instance.Closing, handler
C# 
public event WindowEventHandler Closing
Delphi 
public event Closing: WindowEventHandler; 
JScript 
In JScript, you can handle the events defined by another class, but you cannot define your own.
Managed Extensions for C++ 
public: __event WindowEventHandler* Closing
C++/CLI 
public:
event WindowEventHandler^ Closing

Event Data

The event handler receives an argument of type WindowEventArgs containing data related to this event. The following WindowEventArgs properties provide information specific to this event.

PropertyDescription
Handled (Inherited from Intersoft.Client.Framework.ISRoutedEventArgs)Gets or sets a value that indicates the present state of the event handling for a routed event as it travels the route.
HandledBy (Inherited from Intersoft.Client.Framework.ISRoutedEventArgs) 
IsHandledByPrimitive (Inherited from Intersoft.Client.Framework.ISRoutedEventArgs) 
OriginalSource (Inherited from Intersoft.Client.Framework.ISRoutedEventArgs) 
RoutedEvent (Inherited from Intersoft.Client.Framework.ISRoutedEventArgs) 
Source (Inherited from Intersoft.Client.Framework.ISRoutedEventArgs)Gets or sets a reference to the object that raised the event.
Window The window object that relates to the event context.

Example

The following example shows how to prevent a window from being closed by handling its Closing event and set the Handled property of the event data to true.
C#Copy Code
public partial class HomeWindow : UXWindow
{
    public HomeWindow()
    {
        InitializeComponent();
        this.Closing += new Intersoft.Client.Framework.WindowEventHandler(HomeWindow_Closing);
    }

    void HomeWindow_Closing(object sender, Intersoft.Client.Framework.WindowEventArgs e)
    {
        if (DocumentNotSaved)
        {
            MessageBox.Show("Your document has not been saved. Close aborted");

            // When the Handled is set to true, the window will cancel the Close command.
            e.Handled = true;
        }
    }
}

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2012 All Rights Reserved.