Class ExDockManager
- Namespace
- ExControls
- Assembly
- ExControls.dll
Layout of a window into dockable panels like Visual Studio or Rider: the main content in Document and tool panels (ExDockPanel) docked to the left, right, top or bottom. A zone splits into nested rows and columns of groups, several panels in one group are tabs; splitters resize zones and groups. The user can hide a panel, collapse its group to the strip at the edge (auto-hide), drag it with the docking guides (a compass over a group or the document like in Visual Studio) to another place or to a floating window. SaveLayout() and LoadLayout(string?) keep the layout in a string for the application settings.
public class ExDockManager : Control, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable, IThemeable
- Inheritance
-
ExDockManager
- Implements
- Inherited Members
- Extension Methods
Remarks
The manager is created in code (place it with Fill, move the content of the form into Document), add all panels and then load the saved layout. It owns the panels: disposing the manager disposes all of them, including the hidden ones. Texts of the tool tips and the window menu are in Strings.
Constructors
ExDockManager()
Initializes a new instance of the ExDockManager class.
public ExDockManager()
Properties
ActivePanel
[Browsable(false)]
public ExDockPanel? ActivePanel { get; }
Property Value
AllowFloating
Gets or sets whether panels can be moved to floating windows (dragging out of the guides, the window menu, double-click on the caption).
[Browsable(false)]
public bool AllowFloating { get; set; }
Property Value
DefaultSize
Gets the default size of the control.
protected override Size DefaultSize { get; }
Property Value
Document
Gets the container of the main content (the area between the docked zones).
[Browsable(false)]
public Panel Document { get; }
Property Value
Panels
Gets the panels added to the manager (shown and hidden) in the order of adding.
[Browsable(false)]
public IReadOnlyList<ExDockPanel> Panels { get; }
Property Value
Strings
Gets or sets the texts of the tool tips and the window menu.
[Browsable(false)]
public ExDockStrings Strings { get; set; }
Property Value
Methods
AddPanel(ExDockPanel, ExDockPanel)
Adds a panel as a tab to the group of another panel (the active tab of the group stays).
public void AddPanel(ExDockPanel panel, ExDockPanel tabWith)
Parameters
panelExDockPanelpanel with a unique non-empty Key
tabWithExDockPanelpanel of this manager whose group gets the new tab
Exceptions
- ArgumentException
the panel is already in a manager, has no key or its key is used, or
tabWithis not in this manager
AddPanel(ExDockPanel, ExDockPanel, ExDockSide)
Adds a panel to a new group next to the group of another panel: the target group is split and the new one is on the given side of it (nested rows and columns like dragging to an arrow of the compass).
public void AddPanel(ExDockPanel panel, ExDockPanel target, ExDockSide side)
Parameters
panelExDockPanelpanel with a unique non-empty Key
targetExDockPaneldocked or collapsed panel of this manager
sideExDockSideside of the target group where the new group goes
Exceptions
- ArgumentException
the panel is already in a manager, has no key or its key is used, or
targetis not in this manager- InvalidOperationException
targetis floating
AddPanel(ExDockPanel, ExDockSide)
Adds a panel to a new group at the end of the zone on a side and shows it.
public void AddPanel(ExDockPanel panel, ExDockSide side)
Parameters
panelExDockPanelpanel with a unique non-empty Key
sideExDockSideside of the zone
Exceptions
- ArgumentException
the panel is already in a manager, has no key or its key is used
ApplyTheme(ExTheme)
Sets the colors and appearance of the control by the theme.
public void ApplyTheme(ExTheme theme)
Parameters
themeExTheme
Dispose(bool)
Releases the unmanaged resources used by the Control and its child controls and optionally releases the managed resources.
protected override void Dispose(bool disposing)
Parameters
disposingbooltrue to release both managed and unmanaged resources; false to release only unmanaged resources.
DockPanel(ExDockPanel, ExDockPanel)
Moves a panel (shown or hidden) as a tab into the group of another panel, makes it the active tab and shows it.
public void DockPanel(ExDockPanel panel, ExDockPanel tabWith)
Parameters
panelExDockPanelpanel of this manager
tabWithExDockPanelpanel of this manager whose group gets the tab
DockPanel(ExDockPanel, ExDockPanel, ExDockSide)
Docks a panel (shown or hidden) to a new group next to the group of another panel and shows it: the target group is split and the panel is on the given side of it.
public void DockPanel(ExDockPanel panel, ExDockPanel target, ExDockSide side)
Parameters
panelExDockPanelpanel of this manager
targetExDockPanelanother docked or collapsed panel of this manager (a tab of the same group splits the group)
sideExDockSideside of the target group where the panel goes
Exceptions
- InvalidOperationException
targetis floating or the panel itself
DockPanel(ExDockPanel, ExDockSide)
Docks a panel (shown or hidden) to a new group at the end of the zone on a side and shows it.
public void DockPanel(ExDockPanel panel, ExDockSide side)
Parameters
panelExDockPanelpanel of this manager
sideExDockSideside of the zone
FloatPanel(ExDockPanel)
Moves a panel (shown or hidden) to a floating window next to its current place and shows it; a panel that is alone in its group takes the whole group.
public void FloatPanel(ExDockPanel panel)
Parameters
panelExDockPanelpanel of this manager
Exceptions
- InvalidOperationException
AllowFloating or CanFloat is false
GetZoneSize(ExDockSide)
Gets the size of the zone on a side in logical pixels (96 DPI): the width of the left and right zones, the height of the top and bottom ones.
public int GetZoneSize(ExDockSide side)
Parameters
sideExDockSide
Returns
HidePanel(ExDockPanel)
Hides a panel; it keeps its place and ShowPanel(ExDockPanel, bool) returns it there. It does not raise PanelClosing.
public void HidePanel(ExDockPanel panel)
Parameters
panelExDockPanelpanel of this manager
LoadLayout(string?)
Restores a layout saved by SaveLayout(). Call it after adding all panels: panels missing in the layout stay where they are, keys of panels not added are ignored. An empty string keeps the current layout.
public void LoadLayout(string? layout)
Parameters
Exceptions
- FormatException
the text is not a dock layout of a supported version (the layout does not change)
OnActivePanelChanged(EventArgs)
Raises ActivePanelChanged.
protected virtual void OnActivePanelChanged(EventArgs e)
Parameters
OnDpiChangedAfterParent(EventArgs)
Raises the DpiChangedAfterParent event.
protected override void OnDpiChangedAfterParent(EventArgs e)
Parameters
eEventArgsAn DpiChangedEventArgs that contains the event data.
OnFontChanged(EventArgs)
Raises the FontChanged event.
protected override void OnFontChanged(EventArgs e)
Parameters
OnLayout(LayoutEventArgs)
Raises the Layout event.
protected override void OnLayout(LayoutEventArgs levent)
Parameters
leventLayoutEventArgsA LayoutEventArgs that contains the event data.
OnMouseCaptureChanged(EventArgs)
Raises the MouseCaptureChanged event.
protected override void OnMouseCaptureChanged(EventArgs e)
Parameters
OnMouseDown(MouseEventArgs)
Raises the MouseDown event.
protected override void OnMouseDown(MouseEventArgs e)
Parameters
eMouseEventArgsA MouseEventArgs that contains the event data.
OnMouseLeave(EventArgs)
Raises the MouseLeave event.
protected override void OnMouseLeave(EventArgs e)
Parameters
OnMouseMove(MouseEventArgs)
Raises the MouseMove event.
protected override void OnMouseMove(MouseEventArgs e)
Parameters
eMouseEventArgsA MouseEventArgs that contains the event data.
OnMouseUp(MouseEventArgs)
Raises the MouseUp event.
protected override void OnMouseUp(MouseEventArgs e)
Parameters
eMouseEventArgsA MouseEventArgs that contains the event data.
OnPaint(PaintEventArgs)
Raises the Paint event.
protected override void OnPaint(PaintEventArgs e)
Parameters
ePaintEventArgsA PaintEventArgs that contains the event data.
OnPanelClosing(ExDockPanelClosingEventArgs)
Raises PanelClosing.
protected virtual void OnPanelClosing(ExDockPanelClosingEventArgs e)
Parameters
OnPanelStateChanged(ExDockPanelEventArgs)
Raises PanelStateChanged.
protected virtual void OnPanelStateChanged(ExDockPanelEventArgs e)
Parameters
OnVisibleChanged(EventArgs)
Raises the VisibleChanged event.
protected override void OnVisibleChanged(EventArgs e)
Parameters
RemovePanel(ExDockPanel)
Removes a panel from the manager (the panel is not disposed).
public void RemovePanel(ExDockPanel panel)
Parameters
panelExDockPanelpanel of this manager
SaveLayout()
Saves the layout (zones and their sizes, nested rows and columns of groups, tabs, collapsed and hidden panels, floating windows) to a single-line XML string for the application settings. Panels are identified by Key; sizes are in logical pixels, so the layout survives a DPI change.
public string SaveLayout()
Returns
- string
the layout for LoadLayout(string?)
SetAutoHide(ExDockPanel, bool)
Collapses the group of a panel to the strip at the edge or docks it again; a floating group is docked first.
public void SetAutoHide(ExDockPanel panel, bool autoHide)
Parameters
panelExDockPanelpanel of this manager
autoHidebool
SetZoneSize(ExDockSide, int)
Sets the size of the zone on a side in logical pixels (96 DPI); the layout shrinks it when the document would not fit.
public void SetZoneSize(ExDockSide side, int size)
Parameters
sideExDockSideside of the zone
sizeintwidth of the left and right zones, height of the top and bottom ones
ShowPanel(ExDockPanel, bool)
Shows a hidden panel at its last place and selects its tab; with activate it also moves the focus
into the panel (a collapsed panel slides out, a floating window comes to the front).
public void ShowPanel(ExDockPanel panel, bool activate = true)
Parameters
panelExDockPanelpanel of this manager
activateboolmove the focus into the panel
WndProc(ref Message)
Processes Windows messages.
protected override void WndProc(ref Message m)
Parameters
Events
ActivePanelChanged
Occurs when ActivePanel changes.
public event EventHandler? ActivePanelChanged
Event Type
PanelClosing
Occurs before the user hides a panel; the application can keep it open.
public event EventHandler<ExDockPanelClosingEventArgs>? PanelClosing
Event Type
PanelStateChanged
Occurs when a panel changes its state or side (shown, hidden, docked elsewhere, collapsed, floated, removed).
public event EventHandler<ExDockPanelEventArgs>? PanelStateChanged