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
120
UltraOptionSet Items image tooltip
posted

Hi

I have a UltraOptionSet with 3 items, the items are having images at the end. I want to display the tool tip on the image whenever mouse hover is on Items image. Any suggestions.

 

appearance12.TextHAlignAsString = "Left";

this.ultraOptionSet1.Appearance = appearance12;

this.ultraOptionSet1.BorderStyle = Infragistics.Win.UIElementBorderStyle.None;

appearance8.Image = ((object)(resources.GetObject("appearance8.Image")));   //Image tooltip should be enabled here

appearance8.ImageHAlign = Infragistics.Win.HAlign.Right;

appearance8.TextHAlignAsString = "Left";

valueListItem1.Appearance = appearance8;

valueListItem1.CheckState = System.Windows.Forms.CheckState.Checked;

  • 469350
    Offline posted

    Hi,

    I was able to do this using an UltraToolTipManager and some code in the MouseMove event of the OptionSet. Here's the code I used:


            UIElement lastElement = null;
            private void ultraOptionSet1_MouseMove(object sender, MouseEventArgs e)
            {
                // Get the OptionsSet
                UltraOptionSet optionSet = (UltraOptionSet)sender;

                // Get the UIElement that the mouse is currently over.
                UIElement element = optionSet.UIElement.ElementFromPoint(new Point(e.X, e.Y));

                // If this is the same element we got the last time we were in MouseMove,
                // ignore it.
                if (element == this.lastElement)
                    return;

                // Store the last element the mouse was over so we don't show the tooltip
                // repeatedly.
                this.lastElement = element;

                // Get hte ToolTipInfo for the OptionSet control.
                UltraToolTipInfo toolTipInfo = this.ultraToolTipManager1.GetUltraToolTip(optionSet);

                // See if the element is an Image
                ImageUIElement imageElement = element as ImageUIElement;          

                // If it's not an image, just clear the tooltip and bail out.
                if (imageElement == null)
                {
                    this.ultraToolTipManager1.HideToolTip();
                    toolTipInfo.ToolTipText = string.Empty;           
                    return;
                }

                // If the element is an image, get the associated ValueListItem
                ValueListItem item = imageElement.GetContext(typeof(ValueListItem)) as ValueListItem;
                if (item != null)
                {
                    // If we get here, we know that the mouse is over an ImageUIElement inside
                    // an item on the OptionSet. So set the ToolTipText.
                    toolTipInfo.ToolTipText = item.DisplayText;
                }
            }