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

Tooltip with dynamic data

3 Answers 75 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tech
Top achievements
Rank 1
Tech asked on 21 Aug 2013, 06:33 AM
Hello,

I am using a tooltip inside a RadDataBoundListBox. I want to customize the tooltip as provided in the example:

<
<Rectangle Width="100"
           Height="100"
           Fill="White">
    <telerikPrimitives:RadToolTipService.ToolTip>
        <local:ToolTipData Name="Rectangle"
                           Description="A rectangle UIElement that inherits from Shape."/>
    </telerikPrimitives:RadToolTipService.ToolTip>

    <telerikPrimitives:RadToolTipService.Template>
        <DataTemplate>
            <StackPanel>
                <TextBlock Text="{Binding Name}"/>
                <TextBlock Text="{Binding Description}"/>
            </StackPanel>
        </DataTemplate>
    </telerikPrimitives:RadToolTipService.Template>
</Rectangle> >
However, the below part is static:
 <local:ToolTipData Name="Rectangle"
                           Description="A rectangle UIElement that inherits from Shape."/>

Since I am already using databinding for the listbox, I can bind the values directly to the tooltip template. However,
I am unable to invoke it.

Please advise.

3 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 23 Aug 2013, 08:16 AM
Hello,

Please refer to the other support thread you have opened regarding the same question.

Thanks for your time.

Regards,
Deyan
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Thomas
Top achievements
Rank 1
answered on 27 Dec 2013, 05:17 PM

I'm having the same issue at the moment. Could you share the solution publicly?

Thanks

Thomas

0
Vijay
Top achievements
Rank 1
answered on 29 Dec 2013, 11:34 PM
This is the solution which I received from Telerik support and it worked right of the bat!

Well, to make the content dynamic you don't need to explicitly set a static ToolTip just like you are doing. What you need to do is bind the RadToolTipService.ToolTip property to the DataContext of the current RadDataBoundLIstBoxItem. This will work this way:

RadToolTipService.ToolTip = "{Binding DataContext}"

After doing this, you need to simply define a DataTemplate for the tooltip as you've already done and bind the corresponding elements in it.

The only thing I made change is as below:

RadToolTipService.ToolTip = "{Binding}"

Hope it helps to resolve your issue.
Tags
ToolTip
Asked by
Tech
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Thomas
Top achievements
Rank 1
Vijay
Top achievements
Rank 1
Share this question
or