The shadow from the tooltip is not displayed, tell me how to solve this problem?

<Style TargetType="{x:Type ToolTip}"> <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}" /> <Setter Property="Background" Value="#272e3b" /> <Setter Property="BorderBrush" Value="#3a404c" /> <Setter Property="HasDropShadow" Value="True"/> <Setter Property="Foreground" Value="#b3b3b3" /> <Setter Property="BorderThickness" Value="1" /> <Setter Property="HorizontalContentAlignment" Value="Center" /> <Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="FontSize" Value="15" /> <Setter Property="Padding" Value="6" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ToolTip}"> <Border x:Name="border" Background="{TemplateBinding Background}" CornerRadius="1" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true"> <ContentPresenter x:Name="contentPresenter" Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Focusable="False" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" MinHeight="10" MinWidth="50" TextBlock.TextAlignment="Center" /> </Border> <ControlTemplate.Triggers> <Trigger Property="ToolTipService.HasDropShadow" Value="True"> <Setter Property="Margin" TargetName="border" Value="1"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> 

    1 answer 1

    There is no shadow in your style that can be displayed, so it is not displayed. Add shadow rendering and show it. You can do this, for example, like this: first, we set the outer margin of Margin so that our shadow is not clipped during the output:

     <Border x:Name="border" Margin="10" ... 

    Now let's replace the code in the trigger:

     <ControlTemplate.Triggers> <Trigger Property="HasDropShadow" Value="True"> <Setter Property="Effect" TargetName="border"> <Setter.Value> <DropShadowEffect Color="Red" /> </Setter.Value> </Setter> </Trigger> </ControlTemplate.Triggers> 
    • Ohh thank you !! Thank! - Elizabeth
    • @ Elizabeth, if the answer satisfies you, please click on the check mark next to the answer, this action marks my answer as correct. - ixSci