Syncfusion.Windows.Forms.Tools Namespace : CommandBarController Class

CommandBarController Class

The CommandBarController acts as a central point of control for the CommandBars hosted on a form.The CommandBarController acts as a central point of control for the CommandBars hosted on a form.
Object Model
CommandBarController ClassCommandBarController.CommandBarsCollection ClassCommandBar ClassCommandBar ClassOffice2007Colors ClassOffice2010Colors ClassCommandBarControllerVisualStyle Class
<DesignerAttribute(Syncfusion.Windows.Forms.Tools.Design.CBControllerDesigner, System.ComponentModel.Design.IDesigner)>
<DescriptionAttribute("Component which hosts command Bars in a form.")>
<ToolboxBitmapAttribute(Syncfusion.Windows.Forms.Tools.CommandBarController, "ToolboxIcons.commandbarcontroller.bmp")>
Public Class CommandBarController 
   Inherits Syncfusion.Windows.Forms.Core.BaseComponent
   Implements Syncfusion.Windows.Forms.IVisualStyle, ICBControllerDesignerInvoke, Syncfusion.WinForms.Theme.IThemeProvider 
Dim instance As CommandBarController
[Designer(Syncfusion.Windows.Forms.Tools.Design.CBControllerDesigner, System.ComponentModel.Design.IDesigner)]
[Description("Component which hosts command Bars in a form.")]
[ToolboxBitmap(Syncfusion.Windows.Forms.Tools.CommandBarController, "ToolboxIcons.commandbarcontroller.bmp")]
public class CommandBarController : Syncfusion.Windows.Forms.Core.BaseComponent, Syncfusion.Windows.Forms.IVisualStyle, ICBControllerDesignerInvoke, Syncfusion.WinForms.Theme.IThemeProvider  

The Essential Tools CommandBars framework implements a hosting environment that can be used for creating toolbars, statusbars and rebars similar to those that are present in the Microsoft Visual Studio.NET IDE and the Microsoft Office XP product suite. A CommandBar, similar to Win32/MFC control bars, is purely a container control that is responsible only for it's layout state and it is the client window, such as a ToolBar, StatusBar or any other Windows Forms control, that provides the CommandBar with it's functional identity.

CommandBars have two basic states - a docked state and a floating state. In the docked state, the CommandBars are usually aligned along one of the borders (left, right, top or bottom) of the host form. Depending upon the preferences set, the bar can either take up an entire row as in the case of a menu or share it's space with other bars within a particular row as with toolbars and rebars. By default, a docked CommandBar has a gripper and a drop-down button with a customizable click event. The gripper can be used to reposition the bar within a row, move it between rows and to drag it out of the frame and float as a separate window. In the docked mode, when the row width is adequate, the CommandBars are usually sized to their maximum length. However, reducing the frame width/height will, based on the user-setting, force the CommandBar to reduce in size while retaining the same height or wrap thereby increasing the bar height. The wrapping mode is particularly useful for toolbars and is fully customizable. In the floating state, the CommandBar is parented by a floating window that can dragged around the desktop. A floating CommandBar can be redocked to it's host by either double-clicking it or by dragging it over one of the edges of the host form.

The CommandBarController class, as the name implies, serves as a form-scope controller for all the CommandBars. Attributes that are common across all CommandBars within a host form, such as the EnabledDockBorders and PersistState are usually set on the CommandBarController instance. The CommandBarController implements the API and the requisite design-time support for creating and working with CommandBars.

The sample code shows how to create and initialize a CommandBarController, create a CommandBar control that is initially docked to the top border of the form and hosts a Panel control and finally add the CommandBar to the CommandBarController's collection. private void InitializeCommandBars() { // Create the CommandBarController this.commandBarController1 = new Syncfusion.Windows.Forms.Tools.CommandBarController(); ((System.ComponentModel.ISupportInitialize)(this.commandBarController1)).BeginInit(); // Set the CommandBarController's host form this.commandBarController1.HostForm = this; this.commandBarController1.PersistState = true; // Create the CommandBar control this.commandBarAddress = new Syncfusion.Windows.Forms.Tools.CommandBar(); // Set the CommandBar Layout/Behavior/Appearance attributes this.commandBarAddress.DockBorder = Syncfusion.Windows.Forms.Tools.DockBorder.Top; this.commandBarAddress.HideDropDownButton = true; this.commandBarAddress.MaxLength = 400; this.commandBarAddress.MinHeight = 26; this.commandBarAddress.MinLength = 50; this.commandBarAddress.Name = "commandBarAddress"; this.commandBarAddress.RowIndex = 1; this.commandBarAddress.RowOffset = 1; this.commandBarAddress.Text = "Address"; // Create the ComboBox control and add it to the CommandBars Controls collection this.comboBox1 = new System.Windows.Forms.ComboBox(); this.commandBarAddress.Controls.AddRange(new System.Windows.Forms.Control[] {this.comboBox1}); // Add the CommandBar to the CommandBarController.CommandBars collection this.commandBarController1.CommandBars.Add(this.commandBarAddress); ((System.ComponentModel.ISupportInitialize)(this.commandBarController1)).EndInit(); } Private Sub InitializeCommandBars() ' Create the CommandBarController Me.commandBarController1 = New Syncfusion.Windows.Forms.Tools.CommandBarController(Me.components) CType(Me.commandBarController1, System.ComponentModel.ISupportInitialize).BeginInit() ' Set the CommandBarController's host form Me.commandBarController1.HostForm = Me Me.commandBarController1.PersistState = True ' Create the CommandBar control Me.commandBarAddress = New Syncfusion.Windows.Forms.Tools.CommandBar() ' Set the CommandBar Layout/Behavior/Appearance attributes Me.commandBarAddress.DockState = Syncfusion.Windows.Forms.Tools.CommandBarDockState.Top Me.commandBarAddress.MaxLength = 400 Me.commandBarAddress.MinHeight = 26 Me.commandBarAddress.MinLength = 50 Me.commandBarAddress.Name = "commandBarAddress" Me.commandBarAddress.RowIndex = 1 Me.commandBarAddress.RowOffset = 1 Me.commandBarAddress.Text = "Address" ' Create the ComboBox control and add it to the CommandBars Controls collection Me.comboBox1 = New System.Windows.Forms.ComboBox() Me.commandBarAddress.Controls.AddRange(New System.Windows.Forms.Control() {Me.comboBox1}) ' Add the CommandBar to the CommandBarControllers CommandBars // collection Me.commandBarController1.CommandBars.Add(Me.commandBarAddress) CType(Me.commandBarController1, System.ComponentModel.ISupportInitialize).EndInit() End Sub
Inheritance Hierarchy



Syncfusion.Tools.Windows: 17.4460.0.39

See Also