chr
2025-02-24 104cad5ee53eb05d3a89d508a029425726ae89ae
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:ui="clr-namespace:HMI.UI"
                    >
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/HMI.UI;component/Style/Colors.xaml"/>
        <ResourceDictionary Source="/HMI.UI;component/Resources/Font/Font.xaml"/>
    </ResourceDictionary.MergedDictionaries>
 
    <Style x:Key="WindowButton" TargetType="Button">
        <Setter Property="Background" Value="{StaticResource MainBorder}"/>
        <Setter Property="ui:DpPlugin.HoverColor" Value="{StaticResource ChildBorder}"/>
        <Setter Property="FontFamily" Value="{StaticResource iconfont}"/>
        <Setter Property="FontWeight" Value="SemiBold"/>
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="Width" Value="50"/>
        <Setter Property="FontSize" Value="20"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="Cursor" Value="Hand"/>
        <Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True"/>
 
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border x:Name="border" Width="{TemplateBinding Width}" Background="{TemplateBinding Background}" 
                            BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0">
                        <Label x:Name="label" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" 
                               HorizontalContentAlignment="Center" VerticalContentAlignment="Center" 
                               Foreground="{TemplateBinding Foreground}"
                                       Content="{TemplateBinding Content}"/>
                    </Border>
 
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="border" Property="Background" Value="{Binding 
                                Path=(ui:DpPlugin.HoverColor),RelativeSource={RelativeSource TemplatedParent}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
 
    <Style x:Key="WindowCloseButton" BasedOn="{StaticResource WindowButton}" TargetType="Button">
        <Setter Property="ui:DpPlugin.HoverColor" Value="Red"/>
    </Style>
 
    <Style x:Key="ChildWindowButton" BasedOn="{StaticResource WindowButton}" TargetType="Button">
        <Setter Property="FontSize" Value="15"/>
        <Setter Property="Width" Value="30"/>
        <Setter Property="Background" Value="{StaticResource ChildBorder}"/>
        <Setter Property="ui:DpPlugin.HoverColor" Value="{StaticResource MainBorder}"/>
    </Style>
 
    <Style x:Key="ChildWindowCloseButton" BasedOn="{StaticResource ChildWindowButton}" TargetType="Button">
        <Setter Property="ui:DpPlugin.HoverColor" Value="Red"/>
    </Style>
 
    <Style x:Key="LinkButton" TargetType="Button">
        <Setter Property="ui:DpPlugin.HoverColor" Value="{StaticResource ChildBorder}"/>
        <Setter Property="FontFamily" Value="{StaticResource iconfont}"/>
        <Setter Property="Foreground" Value="{StaticResource ChildBorder}"/>
 
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <TextBlock Style="{x:Null}" x:Name="label" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                               Foreground="{TemplateBinding Foreground}"
                                       Text="{TemplateBinding Content}"/>
 
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="label" Property="Foreground" Value="{Binding 
                                Path=(ui:DpPlugin.HoverColor),RelativeSource={RelativeSource TemplatedParent}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>