WPF实现事件绑定:WPF 如何实现事件绑定 (MVVM)
WPF 控件CommandParameter绑定多个参数:
WPF 通过 CommandParameter 传递当前窗体到 ViewModel:WPF 通过 CommandParameter 传递当前窗体到 ViewModel_wpf commandparameter 传当前控件对象-CSDN博客
1、控件边框阴影
<Border Background="Red" CornerRadius="0" BorderThickness="5" BorderBrush="Green" Margin="125,157,564,24" RenderTransformOrigin="0.5,0.5" >
<!--<TextBlock Height="100" Background="Green"/>-->
<Border.Effect>
<DropShadowEffect Color="#8a8a8a" ShadowDepth="0" Opacity="0.8" BlurRadius="40" Direction="0"/>
</Border.Effect>
</Border>
<Button Width="100" Height="112" VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="0,0,0,24">
<Button.Effect>
<DropShadowEffect Color="Red" ShadowDepth="20" BlurRadius="20" Opacity="0.3"/>
</Button.Effect>
</Button>
2、自定义圆角按钮模板
<Style TargetType="Button" x:Key="RadiusButton">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border CornerRadius="100 100 100 100" Background="#FF7476BA">
<Border.Effect>
<DropShadowEffect Color="#8a8a8a" Opacity="0.6" BlurRadius="25" Direction="1"/>
</Border.Effect>
<Label HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Content="{TemplateBinding Button.Content}" Foreground="{TemplateBinding Button.Foreground}" FontSize="{TemplateBinding Button.FontSize}"></Label>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
3、自定义CheckBox的选择框大小和设置圆角选中框
<CheckBox FontSize="16" VerticalContentAlignment="Center" Height="30">
圆角复选框
<CheckBox.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="15"/>
<Setter Property="BorderBrush" Value="#272A2F"/>
</Style>
</CheckBox.Resources>
<CheckBox.LayoutTransform>
<ScaleTransform ScaleX="2" ScaleY="2" />
</CheckBox.LayoutTransform>
</CheckBox>