Category / Section
How to customize the CommandBar item alignment in CommadBarController?
1 min read
Refer to the following steps for CommandBar items alignment.
- Command Bar is not a container type of control and it allows you to rearrange the controls in desired position.
- You have to add the desired controls as Panel child controls.
- Then add them as CommandBar control child.
The following code example is to demonstrate the same.
C#
//Adding panel1 as its child component this.commandBarAddress.Controls.Add(this.panel1); //Aadding child items to panel this.panel1.Controls.Add(this.buttonAdv1); //Alignment can be set by using dock property or can place the control as required this.buttonAdv1.Dock = System.Windows.Forms.DockStyle.Right;
VB
'Adding panel1 as its child component Me.commandBarAddress.Controls.Add(Me.panel1) 'Adding child items to panel Me.panel1.Controls.Add(Me.buttonAdv1) 'Alignment can be set by using dock property or can place the control as required Me.buttonAdv1.Dock = System.Windows.Forms.DockStyle.Right
Sample
http://www.syncfusion.com/downloads/support/directtrac/general/Commadbar-632032339.zip