Intersoft ClientUI 8 > ClientUI Fundamentals > Window and Dialog Boxes Overview > Window and Dialog Boxes How-to Topics > How-to: Open a UXWindow |
This example shows how to open a UXWindow.
By default, a UXWindow is not automatically shown eventhough it is defined in the UXDesktop control, or when used independently.
To show a window, you set its IsClientVisible property to True. If you use MVVM pattern development, you can bind this property to control the window's visibility in your ViewModel. For more information about MVVM pattern, see MVVM Pattern Overview.
The following example shows how to show a window when the desktop control is loaded.
C# |
Copy Code
|
---|---|
<Intersoft:UXPage xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:Intersoft="http://intersoft.clientui.com/schemas" xmlns:local="ClientUIApplication_Docs.Desktop" mc:Ignorable="d" Title="UXDesktop1 Page" d:DesignWidth="640" d:DesignHeight="480"> <Grid x:Name="LayoutRoot"> <Intersoft:UXDesktop> <local:HomeWindow WindowName="wndHome" /> </Intersoft:UXDesktop> </Grid> </Intersoft:UXPage> |
If you prefer to use API over property-based approach, you can call the Show method of the window control to display the window.
The following example shows how to create a new instance of HomeWindow class and show the window using API on a button click.
C# |
Copy Code
|
---|---|
private void UXButton1_Click(object sender, RoutedEventArgs e) { HomeWindow window = new HomeWindow(); window.Show(); } |