Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
900
Separately Handling Image and Text click on an Item
posted

Hi, I would like to separately handle clicking on an image and clicking on text in the items in an UltraExplorerBarGroup.  I'm sure this is possible with the UI Elements, but I'm not sure what elements to check if the mouse is over in the click event.  Anybody know?

Thanks,

~Karen

Parents
No Data
Reply
  • 69832
    Offline posted

    /// <summary>
    /// Handles the UltraExplorerBar's MouseDown event.
    /// </summary>
    private void explorerBar_MouseDown(object sender, MouseEventArgs e)
    {
        UltraExplorerBar explorerBar = sender as UltraExplorerBar;
        UIElement controlElement = explorerBar.UIElement;
        UIElement elementAtPoint = controlElement != null ? controlElement.ElementFromPoint( e.Location ) : null;
        TextUIElement textElement = null;
        ImageUIElement imageElement = null;

        while ( elementAtPoint != null )
        {
            textElement = elementAtPoint as TextUIElement;
            imageElement = textElement != null ? null : elementAtPoint as ImageUIElement;

            if ( textElement != null || imageElement != null )
                break;

            elementAtPoint = elementAtPoint.Parent;
        }

        if ( textElement != null )
        {
            //  Text was clicked
        }
        else
        if ( imageElement != null )
        {
            //  Image was clicked
        }
    }

     

Children
No Data