ASP.NET Pack Programmer's Guide
WindowHost

The WindowHost control represents a container of windows. The Window control derives from WindowBase and represents a window with header, content and status bar. Windows within the WindowHost can be free-floating, minimized, maximized or pinned in position.

 Note

More information about the Window control can be found in the Window topic.

Server side

Accessing windows

Use the Windows property to get a reference to the control's collection of Window instances.

Managing windows

Minimizing, maximizing, pinning, opening and closing of a window within the WindowHost is defined by the following set of properties: WindowState and Visibility. The EnabledInteractions property specifies what type of interactions that can be applied to a Window.

ASPX  Copy Code

<%-- Window1 is in the default state - all interactions are enabled, it is visible and in normal state. --%>
<ui:Window ID="Window1" runat="server" Title="Window1"></ui:Window>

<%-- Window2 is minimized, visible and with resizing and pinning disabled. --%>
<ui:Window ID="Window2" runat="server" Title="Window2" WindowState="Minimized" EnabledInteractions="Drag, Minimize, Maximize, Refresh, Close"></ui:Window>

<%-- Window3 will not be shown. --%>
<ui:Window ID="Window3" runat="server" Title="Window3" Visibility="Hidden"></ui:Window>

The WindowHost tracks the zIndex of the child windows, ensuring that the active window is always topmost. The base index from which all windows will be offset by is determined by the value of the BaseZIndex property.

Adding items

Use WindowHost.Windows.Add method to add a new window to the collection.

C#  Copy Code

Window window = new Window();
window.ID = "ServerWindow" + WindowHost1.Windows.Count.ToString();
window.Title = window.ID;
WindowHost1.Windows.Add(window);
WindowHost1.DataBind();

VB.NET  Copy Code

Dim window As New Window()
window.ID = "ServerWindow" & WindowHost1.Windows.Count.ToString()
window.Title = window.ID
WindowHost1.Windows.Add(window)
WindowHost1.DataBind()

Removing items

Use WindowHost.Windows.Remove or WindowHost.Windows.RemoveAt to remove a specified window from the collection.

C#  Copy Code

WindowHost1.Windows.RemoveAt(WindowHost1.Windows.Count - 1);
WindowHost1.DataBind();

VB.NET  Copy Code

WindowHost1.Windows.RemoveAt(WindowHost1.Windows.Count - 1)
WindowHost1.DataBind()

Events

The following events are exposed by the WindowHost control.

Event

Event arguments

Description

WindowCreated

WindowEventArgs

Raised when a Window is created.

WindowDeleted

WindowEventArgs

Raised when a Window is deleted.

Client side

Getting a reference to the control

You can access the control on the client side by its ClientID.

JavaScript  Copy Code

var windowHost = $find("WindowHost1");
var windowHost = $find("<%= WindowHost1.ClientID %>");

Accessing windows

Use the getAllWindows method to get a reference to the control's windows array. Use the getActiveWindow method to access the currently active window. To get references to all closed windows use the getClosedWindows function.

Manipulating windows

Use the minimizeAllrestoreAll, closeAll and showAll methods to respectively minimize, restore, close or show all child windows.

Adding items

Use the WindowHost.createWindow method to add a new window to its windows array. The createWindow method accepts as parameter a JSON object, containing the data for the new item. Use the data object to define values for the properties and events, exposed by the Window class.

JavaScript  Copy Code

windowHost.createWindow({ 
    properties: { title: "Client window", windowState: MindFusion.UI.Web.WindowState.Maximized}, 
    events: { closing: onWindowClosing}
});

Removing items

Use the WindowHost.deleteWindow method to remove a specified window from the array.

JavaScript  Copy Code

windowHost.deleteWindow(windowHost.getAllWindows()[0]);

Events

The following client-side events are exposed by the WindowHost class.

Event

Event arguments

Script property

Description

controlLoaded

-

ControlLoadedScript

Raised just after the control has finished loading and is ready for interaction.

windowChanged

WindowEventArgs

ActiveWindowChangedScript

Raised when the active window in the control is changed.