MindFusion.Silverlight Package Programmer's Guide
WindowHost Class
Remarks See Also
 





Represents a container for Window objects.

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

 Syntax

C#  Copy Code

public class WindowHost : Control

Visual Basic  Copy Code

Public Class WindowHost
    Inherits Control

 Remarks

The WindowHost is a special control which acts as a container of Window objects and enables interactive operations on the windows such as resizing and minimizing.

 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.Silverlight;assembly=MindFusion.UI.Silverlight"
  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
                            MindFusion.UI.Silverlight.WindowHost

 See Also

WindowHost Members
MindFusion.UI.Silverlight Namespace