<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:dd="https://gitee.com/akwkevin/aistudio.-wpf.-diagram">

    <dd:BrushOpacityConverter x:Key="BrushOpacityConverter"/>

    <Style x:Key="FlatButtonStyle" TargetType="{x:Type ButtonBase}">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Foreground" Value="Black" />
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Padding" Value="5" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ButtonBase}">
                    <Grid>
                        <Border x:Name="border" 
                                Background="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=Background}" 
                                CornerRadius="3" 
                                Padding="{TemplateBinding Padding}" 
                                BorderBrush="{TemplateBinding BorderBrush}" 
                                BorderThickness="{TemplateBinding BorderThickness}">

                            <ContentPresenter x:Name="content" RecognizesAccessKey="True" 
                                         HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                         VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
                                         SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                        </Border>
                    </Grid>
                    <!--触发器-->
                    <ControlTemplate.Triggers>
                        <!--设置鼠标进入时的背景、前景样式-->
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Background" TargetName="border" Value="{Binding Foreground,
                                RelativeSource={RelativeSource Mode=TemplatedParent},
                                Converter={StaticResource BrushOpacityConverter},
                                ConverterParameter=0.16}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Opacity" Value="0.5"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="FlatCircleButtonStyle" TargetType="{x:Type ButtonBase}">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Foreground" Value="Black" />
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Padding" Value="0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ButtonBase}">
                    <Grid>
                        <Ellipse Fill="{TemplateBinding Background}" 
                                 Stroke="{TemplateBinding BorderBrush}" 
                                 StrokeThickness="{TemplateBinding BorderThickness}"
                                 x:Name="border">
                        </Ellipse>

                        <ContentPresenter x:Name="content" RecognizesAccessKey="True" 
                                         HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                         VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
                                         SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                      
                    </Grid>
                    <!--触发器-->
                    <ControlTemplate.Triggers>
                        <!--设置鼠标进入时的背景、前景样式-->
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Fill" TargetName="border" Value="{Binding Foreground,
                                RelativeSource={RelativeSource Mode=TemplatedParent},
                                Converter={StaticResource BrushOpacityConverter},
                                ConverterParameter=0.16}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Opacity" Value="0.5"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
</ResourceDictionary>