Tooltip with dynamic data

4 posts, 0 answers
  1. Tech
    Tech avatar
    1 posts
    Member since:
    Aug 2013

    Posted 21 Aug 2013 Link to this post

    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.
  2. Deyan
    Admin
    Deyan avatar
    2037 posts

    Posted 23 Aug 2013 Link to this post

    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.
  3. DevCraft banner
  4. Thomas
    Thomas avatar
    9 posts
    Member since:
    Jan 2012

    Posted 27 Dec 2013 Link to this post

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

    Thanks

    Thomas

  5. Vijay
    Vijay avatar
    1 posts
    Member since:
    Apr 2013

    Posted 29 Dec 2013 Link to this post

    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.
Back to Top
DevCraft banner