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.
ADAdministrator Syncfusion Team March 10, 2005 02:36 PM
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;
Please refer to the test sample attached that illustrates the above and let me know if this works for you.