Hi Kenneth,
To hide/show a XPMenus.Bar you would have to first get hold of the CommandBarExt object associated with it and set its Visible property accordingly.
// get the CommandBarExt object
cmdbar1 = this.mainFrameBarManager1.GetBarControl(this.bar1) as CommandBarExt;
// set its Visible property
cmdbar1.Visible = false;
// dock the CommandBarExt along any desired edge of the form
cmdbar2.DockState = CommandBarDockState.Left;
1. For the first case, i.e., View >> ToolBars >> Bar1, you could simply handle the appropriate BarItem''s Click event and hide/show the appropriate ToolBar and dock the other.
private void barItem1_Click(object sender, System.EventArgs e)
{
cmdbar1.Visible = false;
cmdbar2.Visible = true;
cmdbar2.DockState = CommandBarDockState.Left;
}
2. For this second case, you would have to handle the VisibleChanged event of the CommandBarExt object associated with the XPMenus.Bar as shown below :
private void CommandBar_VisibilityChanged (object sender, EventArgs arg)
{
CommandBarExt cmdbar = sender as CommandBarExt;
if (cmdbar.Visible)
{
if (cmdbar == cmdbar1)
{
cmdbar2.DockState = CommandBarDockState.Left;
}
else if (cmdbar == cmdbar2)
{
cmdbar1.DockState = CommandBarDockState.Left;
}
}
}
I have attached a
complete_sample that illustrates the above. Please refer to it and let me know if this meets your requirements. Also, make sure that you delete the contents of the Isolated Storage folder in the directory C:\Documents and Settings\{user name}\Local Settings\Application Data\IsolatedStorage before you do the above. Thanks for considering Syncfusion products.
Regards,
Guru Patwal
Syncfusion, Inc.