Intersoft ClientUI 8 > ClientUI Fundamentals > Window and Dialog Boxes Overview > Window and Dialog Boxes How-to Topics > How-to: Close a UXWindow |
This example shows how to close a UXWindow.
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.
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(); } |