Compatible with Silverlight zooming in a browser?

Topics: fixed
Nov 5, 2009 at 5:32 PM

We've noticed that our tooltip using the ToolTipService does not scale properly when the user zooms in in the browser (ctrl+).. the positioning of the tooltip gets all out of whack. i tested on the demo application and it seems to have the same issue.. any ideas?

Coordinator
Nov 6, 2009 at 3:35 PM
I think this might have something to do with a "browser" resize that is triggered due to zooming in on the application.

can you please provide me with some exact steps to reproduce this bug?
what browser do you use for instance? do you zoom in before the tooltip is shown, or while it is shown?

Thanks for reporting!

Kind regards,

Xavier Decoster

>----- Oorspronkelijk bericht -----
>Van
: smartyp [mailto:notifications@codeplex.com]
>Verzonden
: donderdag
, november
5, 2009 06:32 PM
>Aan
: xavier_decoster@telenet.be
>Onderwerp
: Compatible with Silverlight zooming in a browser? [tooltipservice:74216]
>
>From: smartyp
>
>We've noticed that our tooltip using the ToolTipService does not scale properly when the user zooms in in the browser (ctrl+).. the positioning of the tooltip gets all out of whack. i tested on the demo application and it seems to have the same issue.. any ideas?
>
>
Nov 6, 2009 at 3:45 PM

Sure,

1) use IE8 and go here: http://users.telenet.be/xavierdecoster/ToolTipService/default.html

2) mouse over the bottom-left hand corner of the red button, notice that the tooltip shows up directly under the mouse

3) go to View > Zoom > 150%

4) mouse over the bottom-left hand corner of the red button, notice that the tooltip now shows up in a very odd position - in the upper left nowhere near the mouse/button

 

Our example has a pretty fancy tooltip which has a pointer to the field, so it is a more obvious problem for us..

Thanks for your help!

 

 

Coordinator
Nov 6, 2009 at 4:10 PM
Edited Nov 6, 2009 at 4:11 PM

Hi,

i'm pretty sure it has to do with the internal "last known mouse pointer position" that is misaligned with the new display coordinates after zooming in/out.

(if you were zooming/scaling using Silverlight, you wouldn't have the issue, because the tooltips would also scale, but what you do is a browser event, not sure if and how i can trap it in the control)

if it is a very urgent issue, feel free to take the source code and play with the mouseposition property in the tooltipservice. You surely can submit a patch if you found a way to fix it.

 

It might take a week or two before i find the time to investigate it further myself.

I plan on integrating the patch that was recently submitted (to fix the binding problem), so i would like to take this defect with me, and aim for a new release by the end of the year.

If you have any questions in the mean time, don't hesitate to send me a mail or reply on the discussions on this site.

 

Best regards,

 

Xavier Decoster

Coordinator
Jan 31, 2010 at 8:49 AM

Hi,

 

as of v2 of the library, which I released yesterday, this issue should be resolved.

The browser zoomfactor is part of the placement-calculation of the ToolTip's now.

 

Best regards,

 

Xavier Decoster

 

Dec 29, 2010 at 1:54 PM

Hi,


Should I do something to the placement works well ?! 
Here in my application the tooltip doesn't take the zoomfactor and it still appearing in the wrong position.
When the tooltip IsOpen and I try to alter the zoomfactor, the tooltip continues appearing at right the object, but when I leave the mouse e put over again the tooltip appears too distant ....

These are my lines of code:

if (!string.IsNullOrEmpty(NomeBotao))
            {
                // criando tooltip
                var toolTip = new Silverlight.Controls.ToolTips.ToolTip
                                  {
                                      Content = nome,
                                      InitialDelay = new Duration(new TimeSpan(100)),
                                      DisplayTime = new Duration()
                                  };

                
                //adicionando tooltip
                Silverlight.Controls.ToolTips.ToolTipService.SetToolTip(_botao, toolTip);
                Silverlight.Controls.ToolTips.ToolTipService.SetPlacement(_botao, PlacementMode.Right);
                Silverlight.Controls.ToolTips.ToolTipService.SetPlacementTarget(_botao, _botao);
            }

I tried this way too, but didn't work:

var toolTip = new Silverlight.Controls.ToolTips.ToolTip
                {
                    Content = nome,
                    InitialDelay = new Duration(new TimeSpan(100)),
                    DisplayTime = new Duration(),
                    Placement = PlacementMode.Right,
                    PlacementTarget = _botao
                };


                //adicionando tooltip
                Silverlight.Controls.ToolTips.ToolTipService.SetToolTip(_botao, toolTip);

Am I doing some thing wrong ?

 

Thanks ...

Dec 29, 2010 at 5:20 PM
Edited Dec 29, 2010 at 5:40 PM

My app is crashing every time that I try to resize the browser.To solve that I'm not setting the tooltip placement. But its not the behavior that I'm looking for .... To identify why it's happening is so hard for me, because all UIElements that I have in my app uses the tooltip services, elements inside PopUps, inside Gridviews, etc. Some times I can resize the browser and watch only the placement bug, but the behavior that is making-me fell really pissed is my App crashing .... some times when exists a popup opened, sometimes when a tooltip is opened.

I put a breakpoint in my event Application_UnhandledException, then I could see this stacktrace:

 em MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)  
 em MS.Internal.XcpImports.MethodPack(IntPtr objectPtr, String methodName, Object[] rawData)  
 em MS.Internal.XcpImports.UIElement_TransformToVisual(UIElement element, UIElement visual)  
 em System.Windows.UIElement.TransformToVisual(UIElement visual)  
 em Silverlight.Controls.ToolTips.ToolTipService.GetTranslatedPoints(FrameworkElement frameworkElement)  
 em Silverlight.Controls.ToolTips.ToolTipService.PerformPlacement(Double horizontalOffset, Double verticalOffset)  
 em Silverlight.Controls.ToolTips.ToolTipService.OnRootVisualSizeChanged(Object sender, SizeChangedEventArgs e)  
 em System.Windows.SizeChangedEventHandler.Invoke(Object sender, SizeChangedEventArgs e)  
 em System.Windows.FrameworkElement.OnSizeChanged(Object sender, SizeChangedEventArgs e)  
 em MS.Internal.JoltHelper.RaiseEvent(IntPtr target, UInt32 eventId, IntPtr coreEventArgs, UInt32 eventArgsTypeIndex)

Dec 29, 2010 at 6:03 PM

I don't know how, but what I've done worked well.

I'm using the tooltip from Silverlight.Controls.ToolTips (wich has DisplayTime, InitialDelay and Placement properties) but, to set the tooltip I'm using the native silverlight ToolTipServices.

It looks like this

 if (!string.IsNullOrEmpty(NomeBotao))
            {
                // criando tooltip
                var toolTip = new Silverlight.Controls.ToolTips.ToolTip
			Content = nome, 
InitialDelay = new Duration(new TimeSpan(100)),
DisplayTime = new Duration(),
Placement = PlacementMode.Right,
PlacementTarget = _botao
};
               
                //adicionando tooltip
                ToolTipService.SetToolTip(_botao, toolTip);
            }

and when I want to manipulate the tooltip I just make a simple cast:

void _botao_Unloaded(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrEmpty(NomeBotao))
            {
                var toolTip = (Silverlight.Controls.ToolTips.ToolTip)ToolTipService.GetToolTip(_botao);

                // arrumando duracao do tooltip para 100 nanosegundos, ou seja some (praticamente) na hora (apertou botao sumiu tooltip)
                if (toolTip.IsOpen)
                    toolTip.DisplayTime = new Duration(new TimeSpan(1));
            }

            _botao.Unloaded -= _botao_Unloaded;
        }