mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-02 15:50:51 +08:00
项目结构调整
This commit is contained in:
88
Extensions/AIStudio.Wpf.Mind/Styles/Button.xaml
Normal file
88
Extensions/AIStudio.Wpf.Mind/Styles/Button.xaml
Normal file
@@ -0,0 +1,88 @@
|
||||
<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>
|
||||
Reference in New Issue
Block a user