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

Width of ComboBoxBarItem

This may be a simple thing I am missing but I haven''t figured it out so far... I have a ComboBoxBarItem on an XPMenu. I would like it to extend to the edge of the form. All I can do is set the MinWidth property. But when the form resizes to something smaller, the ComboBoxBarItem dissapears. Basically I need to access it''s width and/or left properties but cannot do so. Is there an easier way to make this control extend to the edge of the bar without dissapearing when the form is resized??

5 Replies

AD Administrator Syncfusion Team June 15, 2005 06:26 PM UTC

Hi Duncan, Unfortunately, the BarItems in XPMenus are not actually controls and therefore don''t have the standard properties you might expect. However, the following code snippet should provide the functionality you want: private void Form1_Resize(object sender, System.EventArgs e) { this.comboBoxBarItem1.MinWidth = this.ClientRectangle.Width - 25; } However, please be advised that this assumes that the ComboBoxBarItem is the only item on the Bar and will need to be adjusted accordingly if there are other BarItems present or customization is active. Hope it helps. Regards, Gregory Austin Syncfusion Inc.

DM Duncan McLeod June 15, 2005 08:12 PM UTC

Hi, Yes, I realize I can do that, but what if I have other controls on the menu bar, which may or may not be shown. I can''t really hard code a value of 25. Is there no way to get the width of these controls??? The other thing is that while the ComboBoxBarItem has focus, pressing the left or right arrow keys, or Home or End, etc... do not function as expected. Focus moves to the previous or next control on the bar. Is there a way to avoid this?

AD Administrator Syncfusion Team June 16, 2005 10:34 PM UTC

Hi Duncan, You could use this.mainFrameBarManager1.GetBarControl(this.bar1).ClientRectangle.Width instead of this.ClientRectangle. However, it will still require that offset, as part of the client is occupied by other objects. Regards, Gregory Austin Syncfusion Inc.

AD Administrator Syncfusion Team June 17, 2005 09:13 PM UTC

So there''s no way for me to get the left or right points or client rectangle of the actual combo box?

AD Administrator Syncfusion Team June 17, 2005 09:22 PM UTC

Hi Duncan, I''m afraid there isn''t a normal way to access the ComboBox. I would assume you would be able to access it by modifying the source code, but otherwise I don''t believe it''s possible. Regards, Gregory Austin Syncfusion Inc.

Live Chat Icon For mobile
Up arrow icon