4
Vote

Tooltip Problem

description

Hi,
 
I am using adavnced tooltip in silverlight4, I am creating the treemap , when i hover the mouse in
each block of treemap,Tooltip of previous block is remain visible, sometimes multiple tooltip showes in treemap,
 
how to solve this problem,
 
Thanks & Regards
Sudhir

file attachments

comments

qi_george wrote Jan 25, 2012 at 1:25 PM

I have same problem when use it inside DataGrid control, many of the same tooltips can be created and I am not able to close it.

wrote Mar 28, 2012 at 2:33 PM

wrote Mar 28, 2012 at 2:42 PM

jtcooke wrote Mar 28, 2012 at 2:42 PM

Same problem here. Using a tree control where the data gets re-populated every 10 seconds. My tooltip style has <Setter Property="DisplayTime" Value="Forever" /> because I don't want the tooltips to close until the user mouses out. The problem is if the tree data is reloaded, the tooltips get confused. They don't close and then there are multiple instances of the tooltip on the screen.

nico008 wrote Sep 13, 2012 at 11:25 AM

I have exactly same problem with DataGrid control.
Any fix is welcome.

wrote Sep 13, 2012 at 11:25 AM

gopalakrishnach wrote Oct 9, 2012 at 3:23 PM

I also have same issue with RadGridView. I see many tooltips on my radgridview.

wrote Oct 9, 2012 at 3:24 PM

gopalakrishnach wrote Jan 30, 2013 at 6:06 PM

I was able to solve multiple tooltips problems. Now, I always see ONLY one tooltip.

But I have one more problem. After sometime, I see a tooltip on my UI even though I move out of RadGridView. I tried many ways but could not solve it. Any help is highly appreciated. It's kind of urgent.

gopalakrishnach wrote Feb 1, 2013 at 6:55 PM

I solved the problem of seeing a tooltip on my UI even though I move out of RadGridView.

I gave my placement target as bottom and in ToolTipService.cs in PerformPlacement method, I gave following to display my tooltip/open popup only if the popup comes in valid position else do nothing.

case PlacementMode.Bottom:
    case PlacementMode.Right:
    case PlacementMode.Left:
    case PlacementMode.Top:
      var plugin = new Rect(0.0, 0.0, Application.Current.Host.Content.ActualWidth, Application.Current.Host.Content.ActualHeight);
      var translatedPoints = GetTranslatedPoints((FrameworkElement)placementTarget);
      var toolTip = GetTranslatedPoints((FrameworkElement)parentPopup.Child);
      Point popupLocation = PlacePopup(plugin, translatedPoints, toolTip, placementMode);
      parentPopup.VerticalOffset = popupLocation.Y + verticalOffset;
      parentPopup.HorizontalOffset = popupLocation.X + horizontalOffset;
     __var elements = VisualTreeHelper.FindElementsInHostCoordinates(new Point(MousePosition.X, MousePosition.Y), null) as List<UIElement>;
      if (elements != null)
      {
        if (elements.Contains(CurrentToolTip.PlacementTarget))
        {
          parentPopup.IsOpen = true;
        }
        else
        {
          string s = "here";
        }
      }__
      break;
When I move from one tab to another, the code was throwing exception, in order to solve this I gave the following if condition in GetTranslatedPoints method in ToolTipService.cs
if (frameworkElement != null && frameworkElement.ActualHeight > 0 && frameworkElement.ActualWidth > 0)

previously if was just if (frameworkElement != null)

gopalakrishnach wrote Feb 1, 2013 at 7:01 PM

I solved the problem of multiple tooltips in following way.

I added below method in ToolTipService.cs

__private static void CloseAllToolTips()
{
  var toolTip = GetToolTip(RootVisual);
  foreach (var kvp in elementsAndToolTips)
  {
    //if (!(ReferenceEquals(kvp.Value, toolTip)))
    kvp.Value.Visibility=Visibility.Collapsed;
      kvp.Value.IsOpen = false;
  }
}__
I called this method in TooltipService.cs where ever I want like OnElementMouseLeave and OnElementMouseEnter and so on. This certainly solved my problem.

wrote Feb 14, 2013 at 7:02 PM