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

Get the Width of Bar Items


Is it possible to get the widths of individual BarItems added to a XPToolbar?

1 Reply

VR Vijayalakshmi Roopkumar Syncfusion Team May 25, 2017 07:28 AM UTC

Hi Swetaketu

Thank you for contacting Syncfusion Support.

In XPToolBar, BarItem type of controls are used as its Child controls and its size will be calculated based on the defined font. At present, there is no direct option to achieve this requirement. We have prepared a workaround to retrieve BarItem width approximately. Please find the code example for the same:

Code Example: 
   //code used to measure the font width of XPToolBar 
(TextRenderer.MeasureText(this.barItem3.Text + "  ", this.xpToolBar1.Font).Width.ToString()); 


Vijayalakshmi V.R. 

Live Chat Icon For mobile
Up arrow icon