2013-03-19 45 views
8

我在HTML中設計了一個接口,並希望將其轉換爲WPF,但是在插入陰影時遇到了麻煩。如何在WPF中實現插入陰影效果

box-shadow: inset 0 2px 7px 0 rgba(0, 0, 0, 0.5); 

效果即時尋找在這裏是這個jsFiddle,我怎麼能轉化爲WPF這到底是什麼?

更新

我目前已經根據理查茲答案是低於,它仍然沒有顯示,雖然影子?

<Border Grid.Row="1" CornerRadius="3" Grid.Column="0" Margin="13,0,12,0" BorderThickness="0" BorderBrush="#d2d2d2" ClipToBounds="True" Background="#fff0f0f0" > 
    <Border Background="Transparent" BorderBrush="Black" CornerRadius="3" BorderThickness="0" Margin="0"> 
     <Border.Effect> 
      <DropShadowEffect ShadowDepth="2" BlurRadius="7" Color="Black" Direction="270" Opacity="0.5"/> 
     </Border.Effect> 
    </Border> 
</Border> 
+0

不WPF使用IE7兼容模式呈現? IE7不支持盒子陰影 – 2013-03-19 13:31:37

回答

15

你可以嘗試這樣的事情,因此調整厚度:

<Border Background="LightGray" BorderBrush="DarkGray" 
      BorderThickness="1" ClipToBounds="True"> 
    <Border Background="Transparent" BorderBrush="Black" 
       BorderThickness="0 2 7 0" Margin="-2"> 
    <Border.Effect> 
     <DropShadowEffect ShadowDepth="0" BlurRadius="10"/> 
    </Border.Effect> 
    </Border> 
</Border>