Back to Devexpress

ToolbarFormManager Class

windowsforms-devexpress-dot-xtrabars-dot-toolbarform-09eddac6.md

latest4.5 KB
Original Source

ToolbarFormManager Class

A BarManager that owns bar items displayed inside a ToolbarFormControl.

Namespace : DevExpress.XtraBars.ToolbarForm

Assembly : DevExpress.XtraBars.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
public class ToolbarFormManager :
    ToolbarManagerBase
vb
Public Class ToolbarFormManager
    Inherits ToolbarManagerBase

Remarks

When you convert any form to a ToolbarForm at design-time, both satellite controls ( ToolbarFormManager and ToolbarFormControl) are created automatically.

If you need to create a Toolbar Form in code, create these two additional components as well.

csharp
ToolbarForm myForm = new ToolbarForm();
ToolbarFormManager tfcManager = new ToolbarFormManager() { Form = myForm };
ToolbarFormControl tfcHeader = new ToolbarFormControl() { ToolbarForm = myForm, Manager = tfcManager};
myForm.Controls.Add(tfcHeader);
myForm.ToolbarFormControl = tfcHeader;
vb
Dim myForm As New ToolbarForm()
myForm.Size = New Size(800, 600)
myForm.Text = "Toolbar Form"
Dim tfcManager As New ToolbarFormManager() With {.Form = myForm}
Dim tfcHeader As New ToolbarFormControl() With {.ToolbarForm = myForm, .Manager = tfcManager}
myForm.Controls.Add(tfcHeader)
myForm.ToolbarFormControl = tfcHeader

Bar items owned by a ToolbarFormManager should be placed to the ToolbarFormControl.TitleItemLinks collection. Items’ alignment settings (the BarItem.Alignment property) specify whether these items are aligned to the ToolbarFormControl ‘s left or right side.

csharp
//create four buttons
 BarButtonItem item1 = new BarButtonItem(tfcManager, "Button 1");
 BarButtonItem item2 = new BarButtonItem(tfcManager, "Button 2");
 BarButtonItem item3 = new BarButtonItem(tfcManager, "Button 3");
 BarButtonItem item4 = new BarButtonItem(tfcManager, "Button 4");
 //buttons 3 and 4 will be docked to the ToolbarFormControl's right edge
 item3.Alignment = item4.Alignment = BarItemLinkAlignment.Right;

 //Out of two items added to the TitleItemLinks collection, the item that was added first
 //will be closer to the form edge. For that reason, you need to populate the right area
 //backwards, i.e. start with rightmost item 
 tfcHeader.TitleItemLinks.AddRange(new BarItem[] { item1, item2, item4, item3});
vb
'create four buttons
 Dim item1 As New BarButtonItem(tfcManager, "Button 1")
 Dim item2 As New BarButtonItem(tfcManager, "Button 2")
 Dim item3 As New BarButtonItem(tfcManager, "Button 3")
 Dim item4 As New BarButtonItem(tfcManager, "Button 4")
 'buttons 3 and 4 will be docked to the ToolbarFormControl's right edge
 item4.Alignment = BarItemLinkAlignment.Right
 item3.Alignment = item4.Alignment

 'Out of two items added to the TitleItemLinks collection, the item that was added first
 'will be closer to the form edge. For that reason, you need to populate the right area
 'backwards, i.e. start with rightmost item 
 tfcHeader.TitleItemLinks.AddRange(New BarItem() { item1, item2, item4, item3})

Inheritance

Object MarshalByRefObject Component DevExpress.XtraEditors.ComponentBase ComponentEditorContainer BarManager DevExpress.XtraBars.ToolbarForm.ToolbarManagerBase ToolbarFormManager

See Also

ToolbarFormManager Members

DevExpress.XtraBars.ToolbarForm Namespace