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

XPToolbar Question.

Is it possible to find the right clicked BarItem on an XPToolBar using a Point? I''ve been trying to use the XPToolBar.HitTest method to return the BarItem that a Context Popup had been activated on, however it isn''t returning anything even when I''ve clicked on a BarItem. Please help as soon as possible. Thanks, Jon

1 Reply

AD Administrator Syncfusion Team March 10, 2005 07:36 PM UTC

Hi Jon, You could do so by handling the MouseDown event of the BarControlInternal associated with the XPToolBar as shown below in code : ((BarControlInternal)this.xpToolBar1).MouseDown += new MouseEventHandler(XPToolBar_BarControlInternal_MouseDown); private void XPToolBar_BarControlInternal_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { BarControlInternal bcint = sender as BarControlInternal; Point pt = bcint.PointToScreen(new Point (e.X,e.Y)); BarItem bitem = bcint.HitTest(pt.X, pt.Y) as BarItem; Console.WriteLine(bitem.Text); } } Please refer to the test sample attached that illustrates the above and let me know if this works for you. Regards, Guru Patwal Syncfusion, Inc.

Loader.
Live Chat Icon For mobile
Up arrow icon