Set RadToolTipService properties globally

2 posts, 0 answers
  1. Wetzorke
    Wetzorke avatar
    20 posts
    Member since:
    Aug 2012

    Posted 04 Sep Link to this post

    Hello,

    as mentioned in the title, I would like to set some of RadToolTipServices' properties globally. I tried to set them as follows:
    <Style x:Key="RadToolTipStyle" TargetType="telerik:RadToolTip">
        <Setter Property="Placement" Value="Top"/>
        <Setter Property="HorizontalOffset" Value="10"/>
        <Setter Property="VerticalOffset" Value="10"/>
        ...
    </Style>
    <Style TargetType="telerik:RadToolTip" BasedOn="{StaticResource RadToolTipStyle}"/>
    but this had no effect on the positioning. Do I have to set those properties elsewhere or is this a bug?
    Currently, I got the desired result by adjusting the margin in the template.

    Best regards
  2. Dinko
    Admin
    Dinko avatar
    416 posts

    Posted 07 Sep Link to this post

    Hi Bernd,

    Thank you for your interest in RadToolTip control.

    The implicit style is not working because the properties of the RadToolTip are for per control not for per RadToolTip. That means that setting in style will not work. To change the Placement, HorizontalOffset, VerticalOffset etc. properties globally you can either set the attached properties to every control in your application or override their default value using OverrideMetadata() method. Check the following code snippet.
    static MainWindow()
    {
        RadToolTipService.PlacementProperty.OverrideMetadata(typeof(FrameworkElement), new PropertyMetadata(System.Windows.Controls.Primitives.PlacementMode.Top));
    }


    Regards,
    Dinko
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top