This is a migrated thread and some comments may be shown as answers.

RadToolTipService

6 Answers 231 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 15 May 2012, 03:37 AM
Im not sure if this control is supported, but i seem to be able to use it in my SL4 app..

What i cant seem to do is override the contenttemple, or content in XAML. Is this possible? (none of the properties seem to have any effect what is displayed).

Im using this component because i need fine control over the duration and other propeties that the framework doesnt support out of the box.

6 Answers, 1 is accepted

Sort by
0
Petar Marchev
Telerik team
answered on 17 May 2012, 11:06 AM
Hello Jonathan,

There should be no problem to set a template for the tool tip. You need to use the ToolTipContentTemplate property of the RadToolTipService:
<UserControl.Resources>
 <DataTemplate x:Key="myToolTipTemplate">
  <TextBlock Text="{Binding}" />
 </DataTemplate>
</UserControl.Resources>
 
<Grid x:Name="LayoutRoot" Background="White">
 <Rectangle Width="100" Height="100" Fill="Green"
   telerik:RadToolTipService.ToolTipContent="asd"
   telerik:RadToolTipService.ToolTipContentTemplate="{StaticResource myToolTipTemplate}" />
</Grid>

I have tested the code above in a Silverlight 4 project and it works as expected. 

Regards,
Petar Marchev
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Ken
Top achievements
Rank 1
answered on 19 Jul 2012, 03:47 PM
I've observed a strange behavior of tooltips when using the RadToolTipService versus the out-of-the-box one.

We have some elements with tooltips which sometimes become "obscured", i.e. there's an "overlay" (rectangle with some opacity) painted over them. When this overlay is visible and you hover over an element "underneath" it, normally a tooltip should not be shown (as you're actually hovering over the rectangle, not the element with which the tooltip is associated):
  • with the standard ToolTipService, no tooltip is shown - correct
  • with the RadToolTipService, tooltips appear - wrong

Any idea why this might happen...or maybe it's intentional?

Thanks!

p.s.: looking in the code, it looks like this is because the mousemove event is hooked on the root visual and in the handler the coordinates of the tooltip-enabled elements are checked directly. Any reason why mouseenter/leave are not hooked on the tooltip-enabled elements themselves? Or...why ALL the elements returned by GetElementsInHostCoordinates() are taken into account and not just the first/topmost one?
0
Ken
Top achievements
Rank 1
answered on 20 Jul 2012, 03:58 PM
I tried to change to the code in RadToolTipService so that in the MouseMove handler I would somehow determine if the element is "obscured" or not. Turns out, there is no way to do this.

So, I removed the MouseMove hook on RootVisual altogether and instead, on the SetToolTipContent() call, I hook the MouseEnter/MouseLeave events of the tooltip owner and call the OnMouseEnterElement()/OnMouseLeaveElement() methods. This seems to work fine. 

Could you please give me some feedback whether this is a feasible approach? Or maybe you already know some drawback to it (since you didn't choose to use it)?

Thanks!
0
Yavor
Telerik team
answered on 23 Jul 2012, 08:49 AM
Hi Adrian,

RadToolTip service was designed to create a feature rich framework for tooltips for our controls that works the same way both in Silverlight and WPF. It is important to note that it is not a standalone product and it was created to support the radcontrols infrastructure, therefore we cannot provide support for its usages outside radcontrols. However you can still use it in you application but with no guarantees.

The reason why we choose to use mouse move on the root visual instead of mouse enter / leave was because of scenarios with nested items (the treemap) in which the framework way of showing tooltips doesn't work correctly. The RadToolTip can be used separately from the RadToolTipService, so you can write your own code that opens a radToolTip.

Hope this information helps!

Greetings,
Yavor
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Davor
Top achievements
Rank 1
answered on 27 Aug 2013, 08:14 AM
Hi, i know this is an old topic, but i'm wondering how can i access tha datatemplate i have stored in the XAML
lik this:
<UserControl.Resources>
        <DataTemplate x:Key="myToolTip">           
                <Grid>
                    <Grid>
                    <TextBlock Text="{Binding Path=Head}"
                           HorizontalAlignment="Left"/>
                    <Button Content="X"
                            HorizontalAlignment="Right"
                            MouseLeftButtonUp="mp_MouseLeftButtonUp"/>
                     </Grid>
                    <Grid>
                        <TextBlock Text="{Binding Path=Body}"
                                   Width="relative"
                                   Height="relative" />
                    </Grid>
 
                </Grid>           
        </DataTemplate>
    </UserControl.Resources>

But now i wish to access this template from code using the 

RadToolTipService.SetToolTipContentTemplate()

Could i get an example of usage, please?
0
Ves
Telerik team
answered on 30 Aug 2013, 12:07 PM
Hi Davor,

I am not sure I followed you completely. Do you need to retrieve the DataTemplate from the user control resources? You can get it like this:

this.Resources["myToolTip"]


Best regards,
Ves
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
General Discussions
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Ken
Top achievements
Rank 1
Yavor
Telerik team
Davor
Top achievements
Rank 1
Ves
Telerik team
Share this question
or