Class HostWindow
Represents a special type of DockWindow, which is used internally by RadDock to wrap custom controls as part of the docking framework.
Inherited Members
Namespace: Telerik.WinControls.UI.Docking
Assembly: Telerik.WinControls.RadDock.dll
Syntax
public class HostWindow : DockWindow, INotifyPropertyChanged, IDockWindow
Constructors
HostWindow()
Initializes a new instance of the HostWindow class with no content.
Declaration
public HostWindow()
Remarks
This constructor creates an empty host window. Use LoadContent(Control) to add content after initialization.
HostWindow(Control)
Initializes a new HostWindow instance with the specified control as content.
Declaration
public HostWindow(Control control)
Parameters
System.Windows.Forms.Control
control
The control to host within this window. |
Remarks
The control is added to the window's Controls collection and configured for proper docking behavior.
HostWindow(Control, DockType)
Initializes a new HostWindow instance with the specified control as content and using the desired dock type.
Declaration
public HostWindow(Control control, DockType dockType)
Parameters
System.Windows.Forms.Control
control
The control to host within this window. |
DockType
dockType
The type of docking behavior for this window (Tool window or Document window). |
Remarks
This constructor initializes the window with specific docking behavior determined by the dockType parameter. Tool windows typically support features like auto-hide, while document windows have different behavior.
Properties
Content
Gets the Control instance that is hosted within this window.
Declaration
public Control Content { get; }
Property Value
System.Windows.Forms.Control
The hosted control, or null if no control is currently hosted. |
Remarks
This property returns the primary control that this HostWindow manages and displays. The content control's bounds are automatically managed to fill the window's display area.
DockType
Gets the dock type for this host window.
Declaration
public override DockType DockType { get; }
Property Value
DockType
A DockType value indicating whether this window behaves as a tool window or document window. |
Overrides
Remarks
The dock type determines the window's docking behavior and visual appearance in the RadDock framework. Tool windows typically support features like auto-hide, while document windows have different behavior.
MdiChild
Gets the associated Content as a Form instance when used in standard MDI mode.
Declaration
public Form MdiChild { get; }
Property Value
System.Windows.Forms.Form
The hosted Form if the content is a Form and MDI children are being auto-detected; otherwise, null. |
Remarks
This property only returns a valid Form reference when the HostWindow is being used in MDI mode and the DockManager has AutoDetectMdiChildren enabled.
SerializedDockType
Gets or sets the dock type value used internally by XML serialization.
Declaration
public DockType SerializedDockType { get; set; }
Property Value
DockType
|
Remarks
This property is intended for internal use by the designer and serialization systems. It should not be used directly in application code.
Methods
ActivateAsMdiChild()
Activates the hosted form as an MDI child window.
Declaration
public void ActivateAsMdiChild()
Remarks
This method uses reflection to access the non-public ActivateMdiChild method of the Form class, allowing the hosted MDI child form to become the active MDI child in the parent MDI container. This is used for proper MDI window management when integrating with the standard Windows Forms MDI system.
LoadContent(Control)
Loads a new control as content into this host window, replacing any existing content.
Declaration
public void LoadContent(Control content)
Parameters
System.Windows.Forms.Control
content
The control to host within this window. |
Remarks
This method clears any existing controls, adds the new content, and initializes it for proper docking behavior. Before changing content, the method verifies that the operation is allowed in the current state.
OnClosing(DockWindowCancelEventArgs)
Called when the window is being closed.
Declaration
protected override void OnClosing(DockWindowCancelEventArgs e)
Parameters
DockWindowCancelEventArgs
e
A DockWindowCancelEventArgs that contains the event data. |
Overrides
Remarks
This override notifies the MDI controller when an MDI child window is closing, allowing for proper MDI management and event handling.
OnControlRemoved(ControlEventArgs)
Raises the System.Windows.Forms.Control.ControlRemoved event.
Declaration
protected override void OnControlRemoved(ControlEventArgs e)
Parameters
System.Windows.Forms.ControlEventArgs
e
A System.Windows.Forms.ControlEventArgs that contains the event data. |
Remarks
This override clears the content reference when a control is removed from the window, ensuring proper cleanup and preventing memory leaks.
OnLayout(LayoutEventArgs)
Raises the System.Windows.Forms.Control.Layout event.
Declaration
protected override void OnLayout(LayoutEventArgs e)
Parameters
System.Windows.Forms.LayoutEventArgs
e
A System.Windows.Forms.LayoutEventArgs that contains the event data. |
Remarks
This override ensures that the hosted content's bounds match the display rectangle of this window, maintaining proper sizing and positioning during layout operations.
Show()
Displays the HostWindow if it was previously hidden.
Declaration
public void Show()
Remarks
This method overrides the base Control.Show method to integrate with the RadDock management system. If the window is managed by a DockManager, it will be shown using the appropriate docking infrastructure.