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. Image for the cookie policy date

How to left align a XPMenus.Bar

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.

3 Replies

AD Administrator Syncfusion Team April 29, 2004 10:19 AM UTC

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.

AD Administrator Syncfusion Team April 30, 2004 09:06 AM UTC

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

AD Administrator Syncfusion Team April 30, 2004 12:08 PM UTC

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.

Live Chat Icon For mobile
Up arrow icon