BarManager Class
Provides a manager for controlling bar objects.
[ToolboxBitmap(typeof(BarManager))]
public class BarManager : Component, IDisposable, ICommandTarget, IWeakEventListener
- Inheritance:
- object MarshalByRefObject Component object
- Implements:
- IDisposable ICommandTarget IWeakEventListener
Constructors
BarManager()
Initializes an instance of the class.
public BarManager()
BarManager(IContainer)
Initializes an instance of the class.
public BarManager(IContainer container)
| Parameter | Type | Description |
|---|---|---|
| container | IContainer | An IContainer that represents the container for the component. |
Properties
ActiveMdiChildForm
The active MDI child Form in the host container control.
AutoUpdateCheckGroups
Indicates whether all the checkable buttons in a check group auto-update when one of the buttons is clicked.
public bool AutoUpdateCheckGroups { get; set; }
Property Value
- bool:
trueif all the checkable buttons in a check group auto-update when one of the buttons is clicked; otherwise,false.
Remarks
When this property is set to true, clicks of checkable buttons will automatically call the SetCheckGroupValue(string, IBarCheckableCommand) method.
If this property is set to false, the SetCheckGroupValue(string, IBarCheckableCommand) method must be called manually to update
the check group value when a checkable button is clicked.
AutoUpdateChecks
Indicates whether to toggle single checkable buttons when they are clicked.
public bool AutoUpdateChecks { get; set; }
Property Value
- bool:
trueif single checkable buttons should be toggled when they are clicked; otherwise,false.
Remarks
When this property is set to true, clicks of checkable buttons will automatically toggle
the checked status if the button is not part of a check group.
BuiltInCustomizeDialogEnabled
Indicates whether to automatically display the built-in run-time Customize dialog when dialog-customize mode is entered.
public bool BuiltInCustomizeDialogEnabled { get; set; }
Property Value
- bool:
trueif the built-in run-time Customize dialog should be displayed when dialog-customize mode is entered; otherwise,false.
Remarks
Set this property to false if you intend on using a custom run-time Customize dialog.
CategoryLocalization
A StringDictionary that can be used to provide UI localizations for category names.
[Browsable(false)]
public StringDictionary CategoryLocalization { get; }
Property Value
Remarks
For instance, to display the category File as Localized File in the Customize dialog,
add an entry where File is the key and Localized File is the value.
ClipboardChangedNotificationEnabled
Indicates whether the manager tracks clipboard changes and fires the ClipboardChanged event.
public bool ClipboardChangedNotificationEnabled { get; set; }
Property Value
- bool:
trueif the manager tracks clipboard changes and fires the ClipboardChanged event; otherwise,false.
Remarks
Keep this property false if the ClipboardChanged event functionality is not needed.
CommandUpdateEventDelay
The delay, in milliseconds, between when rounds of the CommandUpdate event fires.
Commands
A BarCommandCollection containing the commands associated with the manager.
[Browsable(false)]
public BarCommandCollection Commands { get; }
Property Value
CustomizeEnabled
Indicates whether customization (via a Customize dialog) is enabled.
public bool CustomizeEnabled { get; set; }
Property Value
- bool:
trueif customization is enabled; otherwise,false.
Remarks
If customization is enabled, a Customize menu item will appear on the run-time context menu and also on the
toolbar options menu.
CustomizeMode
The type of customize mode that is active.
[Browsable(false)]
public BarCustomizeMode CustomizeMode { get; set; }
Property Value
CustomizeSelectedCommandLink
The BarCommandLink that is currently selected if in CustomizeMode.
[Browsable(false)]
public BarCommandLink? CustomizeSelectedCommandLink { get; }
Property Value
DefaultToolBarStyledMenuWrapWidth
The default menu wrap width, in pixels.
public int DefaultToolBarStyledMenuWrapWidth { get; set; }
Property Value
Remarks
This property value is primarily used for menus that have a toolbar style.
DifferentialBarLayoutData
The current differential layout of all the bar objects managed by this BarManager.
[Browsable(false)]
public XmlDocument DifferentialBarLayoutData { get; set; }
Property Value
- XmlDocument:
An
XmlDocumentcontaining the layout data of the current differential layout.
DockableToolBars
A BarManagerDockableToolBarCollection containing the dockable toolbars associated with the manager.
[Browsable(false)]
public BarManagerDockableToolBarCollection DockableToolBars { get; }
Property Value
DockableToolBarsCanClose
The global setting for whether dockable toolbars can be closed.
public bool DockableToolBarsCanClose { get; set; }
Property Value
- bool:
trueif dockable toolbars can be closed; otherwise,false.
Remarks
This setting only affects dockable toolbars whose CanClose property is set to Default. Any other setting on the toolbar instance overrides this global setting.
DockableToolBarsCanDockHostBottom
The global setting for whether dockable toolbars may be docked to the bottom of the host container control.
public bool DockableToolBarsCanDockHostBottom { get; set; }
Property Value
- bool:
trueif dockable toolbars may be docked to the bottom of the host container control; otherwise,false.
Remarks
This setting only affects dockable toolbars whose CanDockHostBottom property is set to Default. Any other setting on the toolbar instance overrides this global setting.
DockableToolBarsCanDockHostLeft
The global setting for whether dockable toolbars may be docked to the left of the host container control.
public bool DockableToolBarsCanDockHostLeft { get; set; }
Property Value
- bool:
trueif dockable toolbars may be docked to the left of the host container control; otherwise,false.
Remarks
This setting only affects dockable toolbars whose CanDockHostLeft property is set to Default. Any other setting on the toolbar instance overrides this global setting.
DockableToolBarsCanDockHostRight
The global setting for whether dockable toolbars may be docked to the right of the host container control.
public bool DockableToolBarsCanDockHostRight { get; set; }
Property Value
- bool:
trueif dockable toolbars may be docked to the right of the host container control; otherwise,false.
Remarks
This setting only affects dockable toolbars whose CanDockHostRight property is set to Default. Any other setting on the toolbar instance overrides this global setting.
DockableToolBarsCanDockHostTop
The global setting for whether dockable toolbars may be docked to the top of the host container control.
public bool DockableToolBarsCanDockHostTop { get; set; }
Property Value
- bool:
trueif dockable toolbars may be docked to the top of the host container control; otherwise,false.
Remarks
This setting only affects dockable toolbars whose CanDockHostTop property is set to Default. Any other setting on the toolbar instance overrides this global setting.
DockableToolBarsCanDrag
The global setting for whether dockable toolbars may be dragged to another location.
public bool DockableToolBarsCanDrag { get; set; }
Property Value
- bool:
trueif dockable toolbars may be dragged to another location; otherwise,false.
Remarks
This setting only affects dockable toolbars whose CanDrag property is set to Default. Any other setting on the toolbar instance overrides this global setting.
DockableToolBarsCanFloat
The global setting for whether dockable toolbars may be contained in a floating window.
public bool DockableToolBarsCanFloat { get; set; }
Property Value
- bool:
trueif dockable toolbars may be contained in a floating window; otherwise,false.
Remarks
This setting only affects dockable toolbars whose CanFloat property is set to Default. Any other setting on the toolbar instance overrides this global setting.
DockableToolBarsHaveOptionsButtons
The global setting for whether dockable toolbars have options buttons.
public bool DockableToolBarsHaveOptionsButtons { get; set; }
Property Value
- bool:
trueif dockable toolbars have options buttons; otherwise,false.
Remarks
This setting only affects dockable toolbars whose HasOptionsButton property is set to Default. Any other setting on the toolbar instance overrides this global setting.
DockableToolBarsHideOnApplicationFocusLoss
Indicates whether dockable toolbars hide when the application loses focus.
public bool DockableToolBarsHideOnApplicationFocusLoss { get; set; }
Property Value
- bool:
trueif dockable toolbars hide when the application loses focus; otherwise,false.
ForwardCommandsTo
The ICommandTarget to forward commands to.
[Browsable(false)]
public ICommandTarget? ForwardCommandsTo { get; set; }
Property Value
HostContainerControl
The Control that should be used as the topmost parent for docking.
ImageList
The ImageList used for item images.
IsRightToLeft
Indicates whether the control is using a right-to-left layout.
[Browsable(false)]
public bool IsRightToLeft { get; }
Property Value
- bool:
trueif the control is using a right-to-left layout; otherwise,false.
KeyboardShortcutsEnabled
Indicates whether keyboard shortcuts are enabled.
public bool KeyboardShortcutsEnabled { get; set; }
Property Value
- bool:
trueif keyboard shortcuts are enabled; otherwise,false.
KeyboardShortcutsVisibleInToolTips
Indicates whether keyboard shortcuts should be visible in tooltips.
public bool KeyboardShortcutsVisibleInToolTips { get; set; }
Property Value
- bool:
trueif keyboard shortcuts should be visible in tooltips; otherwise,false.
MdiChildCloseButtonVisible
Indicates whether maximized MDI child windows (in standard MDI mode) display a close button on the menubar.
public bool MdiChildCloseButtonVisible { get; set; }
Property Value
- bool:
trueif maximized MDI child windows (in standard MDI mode) display a close button on the menubar; otherwise,false.
Remarks
This setting only applies if standard MDI is in use and a child window is maximized.
MdiChildMinimizeButtonVisible
Indicates whether maximized MDI child windows (in standard MDI mode) display a minimize button on the menubar.
public bool MdiChildMinimizeButtonVisible { get; set; }
Property Value
- bool:
trueif maximized MDI child windows (in standard MDI mode) display a minimize button on the menubar; otherwise,false.
Remarks
This setting only applies if standard MDI is in use and a child window is maximized.
MdiChildRestoreButtonVisible
Indicates whether maximized MDI child windows (in standard MDI mode) display a restore button on the menubar.
public bool MdiChildRestoreButtonVisible { get; set; }
Property Value
- bool:
trueif maximized MDI child windows (in standard MDI mode) display a restore button on the menubar; otherwise,false.
Remarks
This setting only applies if standard MDI is in use and a child window is maximized.
MdiChildSystemButtonVisible
Indicates whether maximized MDI child windows (in standard MDI mode) display a system button on the menubar.
public bool MdiChildSystemButtonVisible { get; set; }
Property Value
- bool:
trueif maximized MDI child windows (in standard MDI mode) display a system button on the menubar; otherwise,false.
Remarks
This setting only applies if standard MDI is in use and a child window is maximized.
MenuBar
The MenuBar that is currently the main menu bar, if any.
Modes
A BarModeCollection containing the names of the modes in which the manager may be placed.
PopupMenus
A PopupMenuCollection containing the popup menus associated with the manager.
[Browsable(false)]
public PopupMenuCollection PopupMenus { get; }
Property Value
PopupTowardsCenter
Indicates whether to display popups from DockableToolBar controls towards the center of the host container control.
public bool PopupTowardsCenter { get; set; }
Property Value
- bool:
trueif popups should be displayed towards the center of the host container control; otherwise,false.
ProtectedKeys
The KeysCollection containing Keys that should be flagged as protected.
[Browsable(false)]
public KeysCollection ProtectedKeys { get; }
Property Value
Remarks
Protected Keys cannot be customized by the end-user.
QuickCustomizeEnabled
Indicates whether quick customization (started by holding Alt and clicking on a toolbar button) is enabled.
public bool QuickCustomizeEnabled { get; set; }
Property Value
- bool:
trueif quick customization is enabled; otherwise,false.
Renderer
The control-specific IBarRenderer used to render the bar controls.
public IBarRenderer? Renderer { get; set; }
Property Value
Remarks
If this value is null, then the global renderer will be used instead.
RendererResolved
The IBarRenderer used to render the bar controls.
[Browsable(false)]
public IBarRenderer RendererResolved { get; }
Property Value
Remarks
This property will return a global renderer if there is no control instance renderer override.
The registered renderer type with the UIRendererManager for this property is IBarRenderer.
SelectedMode
The name of the mode that the application is currently in.
Tag
The object that contains user-defined data about the object.
Methods
Dispose(bool)
Releases the unmanaged resources used by the Component and optionally releases the managed resources.
protected override void Dispose(bool disposing)
| Parameter | Type | Description |
|---|---|---|
| disposing | bool |
|
GetAllCategories()
Returns the unique category names as an array of strings.
GetCheckGroupNames()
Returns the unique check group names as an array of strings.
GetCheckGroupValue(string)
Returns the value of a check group.
public IBarCheckableCommand? GetCheckGroupValue(string checkGroupName)
| Parameter | Type | Description |
|---|---|---|
| checkGroupName | string | The name of the check group whose value to retrieve. |
Returns
- IBarCheckableCommand:
The IBarCheckableCommand that is currently checked within the check group.
GetCustomizableCategories()
Returns the unique category names as an array of strings, for the categories that contain at least one run-time customize command.
GetTopLevelBarControl(IBarControl?)
Returns the top-level IBarControl for the specified IBarControl.
public static IBarControl? GetTopLevelBarControl(IBarControl? barControl)
| Parameter | Type | Description |
|---|---|---|
| barControl | IBarControl | The IBarControl to examine. |
Returns
- IBarControl:
The top-level IBarControl for the specified IBarControl.
IsKeyAChordStart(string?, Keys)
Returns whether the specified Keys combination is a chord key start.
public bool IsKeyAChordStart(string? mode, Keys key)
| Parameter | Type | Description |
|---|---|---|
| mode | string | The mode to examine. |
| key | Keys | The Keys combination to examine. |
Returns
IsKeyStandalone(string?, Keys)
Returns whether the specified Keys combination is a stand-alone and does not require a chord to be pressed first.
public bool IsKeyStandalone(string? mode, Keys key)
| Parameter | Type | Description |
|---|---|---|
| mode | string | The mode to examine. |
| key | Keys | The Keys combination to examine. |
Returns
IsShortcutProtected(BarKeyboardShortcut)
Returns whether the specified BarKeyboardShortcut is protected.
public bool IsShortcutProtected(BarKeyboardShortcut shortcut)
| Parameter | Type | Description |
|---|---|---|
| shortcut | BarKeyboardShortcut | The BarKeyboardShortcut to examine. |
Returns
- bool:
trueif the specified BarKeyboardShortcut is protected; otherwise,false.
Remarks
Protected keyboard shortcuts cannot be customized by the end-user.
IsStatusBar(Control)
Tests if a control instance represents a statusbar control.
protected virtual bool IsStatusBar(Control control)
| Parameter | Type | Description |
|---|---|---|
| control | Control | The control to examine. |
Returns
- bool:
trueif the control is a status bar; otherwise,false.
Remarks
The default implementation of this method will include any control whose name starts with 'Status'. Override this method if additional types should be recognized as a statusbar.
LoadBarLayoutFromFile(string)
Load bar layout data from a layout data file.
public void LoadBarLayoutFromFile(string path)
| Parameter | Type | Description |
|---|---|---|
| path | string | Path to the bar layout data file. |
Remarks
This method may throw an exception if the file is not found or if the layout data is invalid.
If the data contains a Commands section, all bar commands in the Commands collection will be cleared in
preparation for the loading of commands in the data.
Merge(IBarControl, IBarControl, bool)
Merges the source IBarControl with a target IBarControl.
public static void Merge(IBarControl sourceBarControl, IBarControl targetBarControl, bool revertAllFirst)
| Parameter | Type | Description |
|---|---|---|
| sourceBarControl | IBarControl | The source IBarControl. |
| targetBarControl | IBarControl | The target IBarControl. |
| revertAllFirst | bool | Whether to revert any existing merges on the target IBarControl before performing the merge. |
OnCommandClick(BarCommandLinkEventArgs)
Raises the CommandClick event.
protected virtual void OnCommandClick(BarCommandLinkEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | BarCommandLinkEventArgs | The event data. |
OnCommandPopup(BarCommandLinkEventArgs)
Raises the CommandPopup event.
protected virtual void OnCommandPopup(BarCommandLinkEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | BarCommandLinkEventArgs | The event data. |
OnCommandUpdate(BarCommandLinkEventArgs)
Raises the CommandUpdate event.
protected virtual void OnCommandUpdate(BarCommandLinkEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | BarCommandLinkEventArgs | The event data. |
OnCustomizeCommandLinkCreated(BarCommandLinkEventArgs)
Raises the CustomizeCommandLinkCreated event.
protected virtual void OnCustomizeCommandLinkCreated(BarCommandLinkEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | BarCommandLinkEventArgs | The event data. |
OnCustomizeModeChanged(EventArgs)
Raises the CustomizeModeChanged event.
protected virtual void OnCustomizeModeChanged(EventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | EventArgs | The event data. |
OnCustomizeSelectedCommandLinkChanged(BarCommandLinkEventArgs)
Raises the CustomizeSelectedCommandLinkChanged event.
protected virtual void OnCustomizeSelectedCommandLinkChanged(BarCommandLinkEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | BarCommandLinkEventArgs | The event data. |
OnKeyTyped(BarKeyTypedEventArgs)
Raises the KeyTyped event.
protected virtual void OnKeyTyped(BarKeyTypedEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | BarKeyTypedEventArgs | The event data. |
OnMenuTearOff(BarControlEventArgs)
Raises the MenuTearOff event.
protected virtual void OnMenuTearOff(BarControlEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | BarControlEventArgs | The event data. |
OnSelectedModeChanged(EventArgs)
Raises the SelectedModeChanged event.
protected virtual void OnSelectedModeChanged(EventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | EventArgs | The event data. |
RaiseCommand(Command)
Raises the specified command.
public virtual bool RaiseCommand(Command command)
| Parameter | Type | Description |
|---|---|---|
| command | Command | The command to raise. |
Returns
- bool:
trueif the command was handled; otherwise,false.
ResetDockableToolBarLayout()
Resets the dockable toolbar layout and the links on each dockable toolbar.
public void ResetDockableToolBarLayout()
Remarks
This method will reset the Position, DockedRow, and DockedColumn properties on each DockableToolBar. It also clears the layout state information and resets the toolbar's links.
This is only useful if you create a custom DockableToolBar-inheriting class that overrides methods such as ResetDockedColumn().
RevertAllMerges(IBarControl)
Reverts any existing merges on the target IBarControl.
public static void RevertAllMerges(IBarControl targetBarControl)
| Parameter | Type | Description |
|---|---|---|
| targetBarControl | IBarControl | The target IBarControl. |
RevertMerge(IBarControl, IBarControl)
Reverts the merge from the source IBarControl on the target IBarControl.
public static void RevertMerge(IBarControl sourceBarControl, IBarControl targetBarControl)
| Parameter | Type | Description |
|---|---|---|
| sourceBarControl | IBarControl | The source IBarControl. |
| targetBarControl | IBarControl | The target IBarControl. |
SaveBarLayoutToFile(string, bool)
Saves the current layout of all the bar objects managed by this BarManager to a layout data file.
public void SaveBarLayoutToFile(string path, bool isComplete)
| Parameter | Type | Description |
|---|---|---|
| path | string | Path to the bar layout data file. |
| isComplete | bool | Whether to save a complete layout (including commands) or just differential data. |
Remarks
The output layout data is stored in XML format. A complete layout should only be used for backup purposes while a differential layout should be used with applications.
SetAsBaselineLayout()
Notifies all elements of the layout that the current layout is the "baseline" for differential layouts.
public void SetAsBaselineLayout()
Remarks
This method should only be used if you programmatically generate your layout instead of using the designer.
SetCheckGroupValue(string, IBarCheckableCommand)
Sets the value of a check group.
public void SetCheckGroupValue(string checkGroupName, IBarCheckableCommand commandToCheck)
| Parameter | Type | Description |
|---|---|---|
| checkGroupName | string | The name of the check group whose value to set. |
| commandToCheck | IBarCheckableCommand | The IBarCheckableCommand to check. |
ShowCustomizeModifySelectionMenu(Control, BarCommandLink, Rectangle)
Shows the customize Modify Selection menu.
public void ShowCustomizeModifySelectionMenu(Control ownerControl, BarCommandLink commandLink, Rectangle bounds)
| Parameter | Type | Description |
|---|---|---|
| ownerControl | Control | The owner Control. |
| commandLink | BarCommandLink | The BarCommandLink for which to display the menu. |
| bounds | Rectangle | The screen Rectangle around which to display the menu. |
Events
ClipboardChanged
Occurs when the contents of the clipboard are changed.
public event EventHandler? ClipboardChanged
Event Type
Remarks
This event will only fire if ClipboardChangedNotificationEnabled is set to true.
Use this event to update the state of an Edit.Paste command so that it reflects whether pasting is allowed.
CommandClick
Occurs when a BarCommand is clicked.
CommandPopup
Occurs when a BarCommand that causes a popup is clicked.
CommandUpdate
Occurs when a BarCommand should be updated.
public event BarCommandLinkEventHandler? CommandUpdate
Event Type
Remarks
If the CommandUpdateEventDelay is greater than 0, a timer fires this event for each command that is on a visible DockableToolBar when the timer expires, allowing for updating of enabled states.
CustomizeCommandLinkCreated
Occurs when a CommandLink is first dropped from the Customize dialog, allowing for initial customization.
public event BarCommandLinkEventHandler? CustomizeCommandLinkCreated
Event Type
Remarks
Use this event to pre-populate child command links for certain command link types like BarPopupButtonLink.
CustomizeModeChanged
Occurs when the CustomizeMode property is changed, indicating to start or end customize mode.
CustomizeSelectedCommandLinkChanged
Occurs when the CustomizeSelectedCommandLink property is changed, while in customize mode.
public event BarCommandLinkEventHandler? CustomizeSelectedCommandLinkChanged
Event Type
Remarks
Use this event to be notified when the selection changes while in customize mode. This can be used to update the enabled state of a Modify Selection button on the Customize dialog.
KeyTyped
Occurs when a possible shortcut key is typed.
MenuTearOff
Occurs when a menu is torn-off to create a dockable toolbar.
SelectedModeChanged
Occurs after the SelectedMode property is changed.
Inherited Members
- MarshalByRefObject.GetLifetimeService()
- MarshalByRefObject.InitializeLifetimeService()
- MarshalByRefObject.MemberwiseClone(bool)
- object.GetType()
- object.MemberwiseClone()
- object.ToString()
- object.Equals(object)
- object.Equals(object, object)
- object.ReferenceEquals(object, object)
- object.GetHashCode()