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
295
Determine click on image on UltraLabel
posted

I have an UltraLabel with an image set like label.Appearance.Image = someImage;

When the label is clicked I want to determine if the click hit the image. How can I accomplish this?

Thanks,
Carlo Diaz

  • 12773
    Suggested Answer
    posted

    Hello,

    You can use MouseEnterElement event in order to handle when the mouse is on the image.  You can use some boolen flag or object in order to mark that you are currently on a Image element. You can handle also MouseLeaveElement and just reset the flag. And after you handle the MouseClick event you can check for this flag.

    See this code snipped how to check for the image element.
            void ultraLabel1_MouseEnterElement(object sender, UIElementEventArgs e)
            {
                if (e.Element is Infragistics.Win.ImageAndTextUIElement.ImageAndTextDependentImageUIElement)
                {
            // set the flag here
                }
            }

    I hope this helps.

    Sincerely,
    Dimi
    Developer Support Engineer
    Infragistics, Inc.