<Window.Resources>
        <BitmapEffectGroup x:Key="bmeButton">
            <DropShadowBitmapEffect/>
        </BitmapEffectGroup>
    </Window.Resources>
    <StackPanel Margin="5">
        <StackPanel Orientation="Horizontal"></StackPanel>
        <Button Width="218" BitmapEffect="{StaticResource bmeButton}" Height="65"></Button>
    </StackPanel>
为什么这段代码在.NET3.5 和4.0下显示不一样呢?在.net 3.5下按钮是有阴影效果的,但是在4.0下出不来

解决方案 »

  1.   

    应该配DropShadowBitmapEffect的相关属性,可能是不同版本的默认不一致
      

  2.   

    I know 了,详见:display different in .NET3.5 and .NET4.0 
      

  3.   

     .NET Framework 4.0 flags BitmapEffects as obsolete. You're supposed to use the Effect class instead. So a button with a drop shadow would look like this:<Button Width="218" Margin="10" Height="65">
    <Button.Effect>
    <DropShadowEffect/>
    </Button.Effect>
    </Button>