Intersoft ClientUI Documentation
How-to: Close a UXWindow

This example shows how to close a UXWindow.

Example

Description

In ClientUI windowing framework, closing a window will permanently destroy the window and free the allocated resources used by the window. Consequently, closing a window is not identical to hiding a window as the implemention is significantly different. You need to carefully design your application and decide whether a particular window should be permanently closed instead of collapsed. You can consider to permanently close a window if the window contains a relatively large amount of objects.

There are also several important factors that determine whether a window will be hidden or closed when initiated by users in the runtime, for example, when users clicked on the "X" button of the window, which are explained in the following:

The following example shows how to close a window by calling the Close method.

Code

C#
Copy Code
private void UXButton1_Click(object sender, RoutedEventArgs e)
{
    // Finds the specified window in the UXDesktop
    IWindow window = desktop1.FindWindow("UXWindow1");

    // Close the window, if found.
    if (window != null)
        window.Close();
}
See Also

Concepts

Other Resources