注意
1、CornerRadius用的也是资源
2、<Border.Effect>这种参数的写法
原始代码
<Border CornerRadius="15" Background="Black" Opacity="0.1">
<Border.Effect>
<DropShadowEffect Color="Black" Opacity="1" ShadowDepth="10"BlurRadius="30"/>
</Border.Effect>
</Border>
抽象成资源放在App.xaml
<!--基本圆角半径-->
<CornerRadius x:Key="BaseRadiusCorner">15</CornerRadius>
<Style x:Key="RoundTransBorder" TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="{StaticResource BaseRadiusCorner}"/>
<Setter Property="Background" Value="Black"/>
<Setter Property="Opacity" Value="0.1"/>
<Setter Property="Effect" >
<Setter.Value>
<DropShadowEffect Color="Black" Opacity="1" ShadowDepth="10"BlurRadius="30"/>
</Setter.Value>
</Setter>
</Style>
调用
<Border Style="{StaticResource RoundTransBorder}"/>
//===== 常用 数字类 资源
<Grid.RowDefinitions /Height>
<GridLength x:Key="PageTopBarHeight" >70</GridLength>
Margin
<Thickness x:Key="ToolBarMargin">2</Thickness>
<CornerRadius
<CornerRadius x:Key="ToolBarCornerRadius">5</CornerRadius>
BackGround
<Brush x:Key="ToolBarBackGroundColor">#30000000</Brush>