We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to customize the style of tooltip in WPF RichTextBox (SfRichTextBoxAdv) control?

Platform: WPF |
Control: SfRichTextBoxAdv |
Published Date: February 15, 2016 |
Last Revised Date: July 22, 2021 |
.NET Framework: 3.5

You can customize the visual appearance of tooltip in WPF RichTextBox (SfRichTextBoxAdv) control by defining custom style for ToolTip control based on your requirement.

The following code example demonstrates the custom style definition for ToolTip control.

XAML

<!-- Defines the custom style for tooltip. -->
<Style x:Key="ToolTipStyle" TargetType="{x:Type ToolTip}">
    <Setter Property="OverridesDefaultStyle" Value="True"/>
    <Setter Property="SnapsToDevicePixels" Value="True"/>
    <Setter Property="BorderThickness" Value="1"/>
    <Setter Property="BorderBrush" Value="#2D2D2D"/>
    <Setter Property="Background"  Value="#000000" />
    <Setter Property="Foreground" Value="#FFFFFF"/>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type ToolTip}">
                <Border x:Name="Root" CornerRadius="2" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}">
                    <ContentPresenter Margin="2" HorizontalAlignment="Center" VerticalAlignment="Top"/>
                </Border>
                <ControlTemplate.Triggers>
                    <Trigger Property="IsOpen" Value="False">
                        <Setter TargetName="Root" Property="Visibility" Value="Collapsed"/>
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
 
<!-- Defines the customized tooltip. -->
<ToolTip x:Key="CustomToolTip" Style="{StaticResource ToolTipStyle}"/>

The following code example demonstrates how to use the customized tooltip in SfRichTextBoxAdv control.

<!-- SfRichTextBoxAdv control with customized tool tip. -->
<RichTextBoxAdv:SfRichTextBoxAdv x:Name="richTextBoxAdv" ToolTip="{StaticResource CustomToolTip}" xmlns:RichTextBoxAdv="clr-namespace:Syncfusion.Windows.Controls.RichTextBoxAdv;assembly=Syncfusion.SfRichTextBoxAdv.Wpf"/>

Customize Tooltip in WPF RichTextBox

View sample in GitHub.

2X faster development

The ultimate WPF UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile