HostWindow
Represents a special type of DockWindow, which is used internally by RadDock to wrap custom controls as part of the docking framework.
Definition
Namespace:Telerik.WinControls.UI.Docking
Assembly:Telerik.WinControls.RadDock.dll
Syntax:
public class HostWindow : DockWindow, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable, IContainerControl, INotifyPropertyChanged, IDockWindow
Inheritance: objectMarshalByRefObjectComponentControlScrollableControlContainerControlTabPanelDockWindowHostWindow...
Implements:
Inherited Members
Constructors
Initializes a new instance of the HostWindow class with no content.
public HostWindow()
This constructor creates an empty host window. Use LoadContent(Control) to add content after initialization.
Initializes a new HostWindow instance with the specified control as content and using the desired dock type.
public HostWindow(Control control, DockType dockType)
The control to host within this window.
dockTypeDockTypeThe type of docking behavior for this window (Tool window or Document window).
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.
Initializes a new HostWindow instance with the specified control as content.
public HostWindow(Control control)
The control to host within this window.
The control is added to the window's Controls collection and configured for proper docking behavior.
Properties
Gets the Control instance that is hosted within this window.
[Browsable(false)]
public Control Content { get; }
The hosted control, or null if no control is currently hosted.
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.
Gets the dock type for this host window.
public override DockType DockType { get; }
A DockType value indicating whether this window behaves as a tool window or document window.
Overrides:
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.
Gets the associated Content as a Form instance when used in standard MDI mode.
[Browsable(false)]
public Form MdiChild { get; }
The hosted Form if the content is a Form and MDI children are being auto-detected; otherwise, null.
This property only returns a valid Form reference when the HostWindow is being used in MDI mode and the DockManager has AutoDetectMdiChildren enabled.
Methods
Activates the hosted form as an MDI child window.
public void ActivateAsMdiChild()
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.
Loads a new control as content into this host window, replacing any existing content.
public void LoadContent(Control content)
The control to host within this window.
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.
Called when the window is being closed.
protected override void OnClosing(DockWindowCancelEventArgs e)
A DockWindowCancelEventArgs that contains the event data.
Overrides:
This override notifies the MDI controller when an MDI child window is closing, allowing for proper MDI management and event handling.
Raises the ControlRemoved event.
protected override void OnControlRemoved(ControlEventArgs e)
A ControlEventArgs that contains the event data.
Overrides:
This override clears the content reference when a control is removed from the window, ensuring proper cleanup and preventing memory leaks.
Raises the Layout event.
protected override void OnLayout(LayoutEventArgs e)
A LayoutEventArgs that contains the event data.
Overrides:
This override ensures that the hosted content's bounds match the display rectangle of this window, maintaining proper sizing and positioning during layout operations.
Displays the HostWindow if it was previously hidden.
public void Show()
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.