Tooltip binding

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

    Posted 14 Nov 2014 Link to this post

    Hi,

    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 :
    <telerik:RadProgressBar>
         <telerik:RadProgressBar.ToolTip>
              <ToolTip Content="{Binding Path=DataContext.SomeProperty, ElementName=SomeParent}"/>
         </telerik:RadProgressBar.ToolTip>
    </telerik:RadProgressBar>

    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 :
    <telerik:RadProgressBar>
         <telerik:RadProgressBar.ToolTip>
              <ToolTip Content="{Binding Path=DataContext.SomeProperty, ElementName=SomeParent}" ContentStringFormat="{}{0:P2}"/>
         </telerik:RadProgressBar.ToolTip>
    </telerik:RadProgressBar>

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

    Thank you,

    Etienne
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 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 
    <telerik:RadProgressBar.ToolTip>
                   <ToolTip
    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.

    Regards,
    Petar Mladenov
    Telerik
     

    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. UI for WPF is Visual Studio 2017 Ready
Back to Top