Tooltip binding

2 posts, 0 answers
  1. Etienne
    Etienne avatar
    45 posts
    Member since:
    Sep 2014

    Posted 14 Nov 2014 Link to this post


    I'm trying to add a tooltip to a radProgressBar and I'm having some issues.

    I did something like that but it doesn't work, it gives an empty tooltip :
              <ToolTip Content="{Binding Path=DataContext.SomeProperty, ElementName=SomeParent}"/>

    Same result for this :
    <telerik:RadProgressBar telerik:RadToolTipService.ToolTipContent="{Binding Path=DataContext.SomeProperty, ElementName=SomeParent}"/>

    The only way I've been able to have something interesting is by doing this :
    <telerik:RadProgressBar ToolTip="{Binding Path=DataContext.SomeProperty, ElementName=SomeParent"/>

    The problem is that I want to use ContentStringFormat and do something like this :
              <ToolTip Content="{Binding Path=DataContext.SomeProperty, ElementName=SomeParent}" ContentStringFormat="{}{0:P2}"/>

    Am I doing somthing wrong or there is a bug with tooltip ?

    Thank you,

  2. Petar Mladenov
    Petar Mladenov avatar
    2882 posts

    Posted 18 Nov 2014 Link to this post

    Hi Etienne,

    There might be some differences when you define the ToolTip inline and when you define it with extended markup syntax 
    especially with how the DataContext is transferred because the tooltip uses Popup and Popups are usually in separate visual tree. However, I believe it is possible to workaround such limitations either with manual setting of DataContext or with a Converter. As for the ProgressBar , you can replace it with System.Windows.Controls.Button to check if the problem is not in Telerik Controls. On the other hand, for the binding issues you can refer to some stackoverflow posts.

    WPF binding with StringFormat doesn't work on ToolTips

    You can also send us an isolated sample in a separate support thread. This way we would be better able to investigate your scenario and advice you better.

    Petar Mladenov

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  3. DevCraft R3 2016 release webinar banner
Back to Top