MindFusion.Wpf Pack Programmer's Guide
Window Class
Remarks See Also
 





Represents a window with title and contents, which can be moved, resized and arranged interactively.

Namespace: MindFusion.UI.Wpf
Assembly: MindFusion.Common.Wpf

 Syntax

C#  Copy Code

public class Window : ContentControl, IComparable<Window>

Visual Basic  Copy Code

Public Class Window
    Inherits ContentControl
    Implements IComparable(Of Window)

 Remarks

The Window class can be used is usually use in conjunction with the WindowHost class. The WindowHost class acts as a container of Window objects and enables the interactive functionality of the windows -moving, resizing and so on.

To add a Window to a host, either add it to its Windows collection or call the Show or ShowDialog methods of the Window passing the host as an argument. Since the Windows property is declared as the ContentProperty of the WindowHost, windows can be added to a WindowHost directly in XAML.

 Example

The Window class can be used is usually use in conjunction with the WindowHost class. The WindowHost class acts as a container of Window objects and enables the interactive functionality of the windows -moving, resizing and so on.

To add a Window to a host, either add it to its Windows collection or call the Show or ShowDialog methods of the Window passing the host as an argument. Since the Windows property is declared as the ContentProperty of the WindowHost, windows can be added to a WindowHost directly in XAML.

The following code illustrates a WindowHost with a single Window defined in XAML:

XAML  Copy Code

<Window x:Class="WpfApplication.Window2"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:ui="clr-namespace:MindFusion.UI.Wpf;assembly=MindFusion.UI.Wpf"
  Title="Window2" Height="394" Width="685">
  <Grid>
    <ui:WindowHost Name="host" Background="#F0F0FF">
      <ui:Window Width="300" Height="200" Header="This is a test window" IsActive="True" Left="100" Top="50" Foreground="White">
        <Grid Margin="5">
          <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto" MinHeight="30" />
          </Grid.RowDefinitions>
          <StackPanel Grid.Row="1" Orientation="Horizontal" Margin="5" HorizontalAlignment="Center">
            <Button Width="80">OK</Button>
            <Button Width="80">Cancel</Button>
          </StackPanel>
          <Label Margin="20,35,0,0" Width="74" Height="25" HorizontalAlignment="Left" VerticalAlignment="Top">Enter name:</Label>
          <TextBox Margin="100,37,25,0" Name="textBox1" Height="22" VerticalAlignment="Top" />
        </Grid>
      </ui:Window>
    </ui:WindowHost>
  </Grid>
</Window>

The code above yields results similar to the following picture:

To adjust the position or size of the window programmatically, use the Left, Top, Width and Height properties respectively. To minimize or maximize the window use its WindowState property.

 Inheritance Hierarchy

System.Object
    System.Windows.Threading.DispatcherObject
        System.Windows.DependencyObject
            System.Windows.Media.Visual
                System.Windows.UIElement
                    System.Windows.FrameworkElement
                        System.Windows.Controls.Control
                            System.Windows.Controls.ContentControl
                                MindFusion.UI.Wpf.Window

 See Also

Window Members
MindFusion.UI.Wpf Namespace