Click here to Skip to main content
15,897,291 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi all,

I have two overlapping scrollviewers and I need to show a tooltip for each visible element inside both scrollviewers. The problem is that only topmost scrollviewer's elements show the tooltip. I have googled and I have read some pages like Hit Testing in the Visual Layer without luck.

Here a code example where only the second tooltip is shown (green rectangle):
XML
<Grid Height="100" Width="300">
  <ScrollViewer>
    <Rectangle Fill="Red" Width="100" HorizontalAlignment="Left" ToolTip="Red" />
  </ScrollViewer>
  <ScrollViewer>
    <Rectangle Fill="Green" Width="100" HorizontalAlignment="Right" ToolTip="Green" />
  </ScrollViewer>
</Grid>

Any idea?

Thanks,

Raúl
Posted
Updated 3-May-11 1:16am
v2
Comments
Tarun.K.S 3-May-11 10:48am    
Set Panel.ZIndex=1 to the first scrollviewer which will put the scrollviewer up, but you won't be able to see the tooltip for Green rectangle.
Raúl Nuño 3-May-11 11:01am    
That's not a solution, I need to show tooltips from both scrollviewers.

1 solution

As it stands, you can't. The element that gets the tooltip support when the items overlap is the element at the top of the z-order. Basically, the problem here is that the red scrollviewer is overlaid by the blue scrollviewer, so even though you hover over the red rectangle, there is an item with a higher z-order getting in the way and preventing the tooltip service from interacting with the red rectangle.

I am confused as to what you are trying to achieve here - by having overlapping scroll viewers, you show the second scrollbar on top of the first, so you could only scroll the second item anyway.
 
Share this answer
 
Comments
Raúl Nuño 3-May-11 18:00pm    
The problem is the scrollviewer. If I replace them with any panel, it would work. So it's impossible? There's no workaround?

I have a reason for using 2 overlapping scrollviewers but it's irrelevant. Both scrolls can be easily syncronized (no problem here).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900