Search code examples
wpftooltip

ToolTip Style ToolTipService.ShowDuration


The Property ToolTipService.ShowDuration is not effected
The other properties are set
How to set ToolTipService.ShowDuration via a Style?

<Style TargetType="ToolTip">
       <Setter Property="FontFamily" Value="Segoe UI SemiLight" />
       <Setter Property="ToolTipService.ShowDuration" Value="20000" />
       <Setter Property="Foreground" Value="{StaticResource BrushLightBlue}" />
</Style>

Specifically I am having this problem with a MenuItem


Solution

  • TooltipService.ShowDuration attached property should be set on the element having the ToolTip. For instance:

    <Style TargetType="{x:Type Button}">
        <Setter Property="ToolTipService.ShowDuration" Value="20000" />
    </Style>
    

    For a MenuItem this should work

    <Style TargetType="Menu">
        <Style.Resources>
            <Style TargetType="MenuItem">
                <Setter Property="ToolTipService.ShowDuration" Value="20000"/>
            </Style>
        </Style.Resources>
    </Style>