Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF How to disable DropShadowEffect

Tags:

wpf

What's the best way to disable a DropShadowEffect, for example if you know you are running in a remote session?

I can think of setting the color to transparent, the blur radius to 0, or the opacity to zero, but not sure if there's any difference in these choices, or if there's a better solution.

like image 878
Dean Avatar asked May 24 '12 14:05

Dean


1 Answers

Style triggers + RenderCapability Tiers is what you need. There are slightly more friendly ways return the render tier capabilities but the general idea is there. When using terminal services, or there's no render capability for hardware effects, you can remove the effect with a style trigger.

<Style>
  <Style.Triggers>
    <Trigger Property="Perf:RenderCapabilityWrapper.Tier" Value="0">
      <Setter Property="Effect" Value="{x:Null}"/>
    </Trigger> 
    <Trigger Property="Perf:RenderCapabilityWrapper.Tier" Value="1">
      <Setter Property="Effect" Value="{StaticResource performanceShadow}"/>
    </Trigger> 
    <Trigger Property="Perf:RenderCapabilityWrapper.Tier" Value="2">
      <Setter Property="Effect" Value="{StaticResource qualityShadow}"/>
    </Trigger> 
  </Style.Triggers>
</Style>
like image 130
erodewald Avatar answered Sep 21 '22 12:09

erodewald