The following forum(s) are migrating to a new home on Microsoft Q&A (Preview): Developing Universal Windows apps!

Ask new questions on Microsoft Q&A (Preview).
Interact with existing posts until December 13, 2019, after which content will be closed to all new and existing posts.

Learn More

 none
ToolTip Border/Background Color RRS feed

  • Question

  • Hi ,

    Please suggest how to remove  hover background color for tootip UWP,after some seconds hovering with background white will appear


    WithRegards,

    Sandeep M 

    Wednesday, November 27, 2019 7:21 AM

All replies

  • Hi,

    From your description, maybe your application is not well adjusted ApplicationTheme.

    In UWP, if the theme of the app is not explicitly set, the theme of the app follows the system. You can try explicitly specifying the RequestedTheme property in the App constructor of App.xaml.cs.

    public App()
    {
        this.InitializeComponent();
        this.Suspending += OnSuspending;
        RequestedTheme = ApplicationTheme.Dark;
    }
    

    At this time, the background color of Tooltip will turn black.

    ---

    If you want to customize the display style of ToolTip, you can modify the default template of ToolTip

    Default Style

    <Style TargetType="ToolTip">
        <Setter Property="Foreground" Value="{ThemeResource ToolTipForeground}" />
        <Setter Property="Background" Value="{ThemeResource ToolTipBackground}" />
        <Setter Property="BorderBrush" Value="{ThemeResource ToolTipBorderBrush}" />
        <Setter Property="BorderThickness" Value="{ThemeResource ToolTipBorderThemeThickness}" />
        <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
        <Setter Property="FontSize" Value="{ThemeResource ToolTipContentThemeFontSize}" />
        <Setter Property="Padding" Value="{ThemeResource ToolTipBorderThemePadding}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ToolTip">
                    <ContentPresenter x:Name="LayoutRoot"
              BorderThickness="{TemplateBinding BorderThickness}"
              Background="{TemplateBinding Background}"
              BackgroundSizing="OuterBorderEdge"
              BorderBrush="{TemplateBinding BorderBrush}"
              MaxWidth="320"
              Content="{TemplateBinding Content}"
              ContentTransitions="{TemplateBinding ContentTransitions}"
              ContentTemplate="{TemplateBinding ContentTemplate}"
              Padding="{TemplateBinding Padding}"
              TextWrapping="Wrap">
    
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="OpenStates">
                                <VisualState x:Name="Closed">
    
                                    <Storyboard>
                                        <FadeOutThemeAnimation TargetName="LayoutRoot" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Opened">
    
                                    <Storyboard>
                                        <FadeInThemeAnimation TargetName="LayoutRoot" />
                                    </Storyboard>
                                </VisualState>
    
                            </VisualStateGroup>
    
                        </VisualStateManager.VisualStateGroups>
                    </ContentPresenter>
    
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    

    Use

    <Button Content="TestButton">
        <ToolTipService.ToolTip>
            <ToolTip Style="{StaticResource YourToolTip}">
                <TextBlock Text="Yo!"/>
            </ToolTip>
        </ToolTipService.ToolTip>
    </Button>
    

    Tips

    If you specify ToolTipService.ToolTip directly to the control, you cannot apply styles. You must create a ToolTip control.

    By the way, We invite you to post new questions in the "Developing Universal Windows apps" forum’s new home on Microsoft Q&A (Preview)!

    Best regards.


    "Developing Universal Windows apps" forum will be migrating to a new home on Microsoft Q&A (Preview)!
    We invite you to post new questions in the "Developing Universal Windows apps" forum’s new home on Microsoft Q&A (Preview)!
    For more information, please refer to the sticky post.

    Wednesday, November 27, 2019 8:37 AM
  • Hi,

    Does my reply solve your problem? Do you have any other questions you want to clarify?

    The UWP section of MSDN is about to be locked down. If you have other questions, please come to Microsoft Q&A to ask questions, and we will continue to answer your questions there.

    Best regards.


    "Developing Universal Windows apps" forum will be migrating to a new home on Microsoft Q&A (Preview)!
    We invite you to post new questions in the "Developing Universal Windows apps" forum’s new home on Microsoft Q&A (Preview)!
    For more information, please refer to the sticky post.

    Tuesday, December 3, 2019 8:08 AM
  • Hi,

    Sorry to disturb you again, we are confirming the status of the question. Did my response resolve your issue?

    Since the UWP section of the MSDN Forum will be locked down in the near future, after that, if you have new questions, welcome to our new community: Microsoft Q&A, where we will continue to answer your questions.

    Best regards.


    "Developing Universal Windows apps" forum will be migrating to a new home on Microsoft Q&A (Preview)!
    We invite you to post new questions in the "Developing Universal Windows apps" forum’s new home on Microsoft Q&A (Preview)!
    For more information, please refer to the sticky post.

    Friday, December 6, 2019 6:23 AM