We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to left align a XPMenus.Bar

Thread ID:





13455 Apr 28,2004 11:58 PM Apr 30,2004 08:08 AM Windows Forms 3
Tags: Tools
Administrator [Syncfusion]
Asked On April 28, 2004 11:58 PM

I have two toolbars and would like to have the second toolbar align left whenever the user hides the first toolbar either clicking "View - Toolbars - Bar1" og right-clicking the toolbar and selecting "Bar2"... I hope you understand what I mean.

Administrator [Syncfusion]
Replied On April 29, 2004 06:19 AM

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.

Administrator [Syncfusion]
Replied On April 30, 2004 05:06 AM

I''m terraybly sorry! I asked for something a little too fast without looking into how standard Microsoft-applications handles the issue. What I want is to have "toolbar1" to become invisible and "toolbar2" to stay where it is. I''m creating an application, where the user switch culture/language. Therefore I have to manually add/remove the toolbars in order to set the right BarName so that the barname is shown in the right language wheneever the user right-clicks the toolbars... Or is there some other way to accomplish this? This is how I do it: ResourceManager rm = new ResourceManager("Culture.Strings", typeof(MyForm).Assembly); barManager.Bars.Clear(); barManager.Bars.Add(mainMenuBar); // ToolBar printRefreshToolbar.BarName = rm.GetString("&Print and Refresh"); barManager.Bars.Add(printRefreshToolbar); regionalSettingsToolbar.BarName = rm.GetString("&Regional Settings"); barManager.Bars.Add(regionalSettingsToolbar); The wierd part is that whenever the culture is set to English (GB or US) - the default culture for the program - the "Regional Settings" toolbar is moved to the left when the "Print and Refresh" toolbar is hidden...? But if the user changes language is stays where is should... I''ve enclosed a picture to should you what I mean. - I''m sorry my Paint-skills are so poor :) Kenneth ToolBar example_5575.zip

Administrator [Syncfusion]
Replied On April 30, 2004 08:08 AM

Hi Kenneth, Thanks for the update and the screenshot. I have created a sample that closely resembles the application in the screenshot and have attached it here. Could you please modify the sample to show the problem (with respect to the culture/language settings) that you are facing ? Let me know in detail how to recreate the problem here, and also the version of Essential Suite that you are using. We appreciate your cooperation, and thanks for choosing Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.