schangxiang@126.com
2025-11-04 f5ed29dc26c7cd952d56ec5721a2efc43cd25992
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    
    
    <Color x:Key="blueColor" A="#FF" R="#0E" G="#81" B="#EC"/>
    <SolidColorBrush x:Key="blueBrush" Color="{DynamicResource blueColor}"/>
 
    <Color x:Key="listSelectedColor" A="#FF" R="#AD" G="#D6" B="#FF"/>
    <SolidColorBrush x:Key="listSelectedBrush" Color="{DynamicResource listSelectedColor}"/>
 
    <Color x:Key="lightBlueColor" A="#FF" R="#DB" G="#EC" B="#FF"/>
    <SolidColorBrush x:Key="lightBlueBrush" Color="{DynamicResource lightBlueColor}"/>
 
    <Style TargetType="{x:Type TextElement}">
        <Setter Property="FontFamily" Value="Microsoft YaHei"/>
    </Style>
    <Style TargetType="{x:Type TextBlock}">
        <Setter Property="FontFamily" Value="Microsoft YaHei"/>
    </Style>
    
    <Style x:Key="BlueButtonStyle" TargetType="Button">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border x:Name="bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="5">
                        <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Foreground" Value="White" />
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="true">
                <Setter Property="Opacity" Value="0.5" />
            </Trigger>
        </Style.Triggers>
    </Style>
 
    <Style x:Key="ULRadioButtonSytle" TargetType="{x:Type RadioButton}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RadioButton}">
                    <Grid >
                        <ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" 
                                          Grid.Column="1" ContentStringFormat="{TemplateBinding ContentStringFormat}" Focusable="False" 
                                          HorizontalAlignment="Center" Margin="0,0,0,0" 
                                          RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                        <Rectangle x:Name="line" Height="1" Fill="{DynamicResource blueBrush}" Opacity="0" VerticalAlignment="Bottom"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Foreground" Value="{DynamicResource blueBrush}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <!--<Setter Property="Fill" TargetName="outerElipse" Value="#FFE6E6E6"/>-->
                        </Trigger>
                        <!--<Trigger Property="IsPressed" Value="True">
                            <Setter Property="Background" TargetName="outerElipse" Value="#20FFFFFF"/>
                        </Trigger>-->
                        <Trigger Property="IsChecked" Value="True">
                            <Setter Property="Foreground" Value="{DynamicResource blueBrush}"/>
                            <Setter Property="Opacity" TargetName="line" Value="1"/>
                            <!--<Setter Property="StrokeThickness" TargetName="outerElipse" Value="0"/>-->
                        </Trigger>
                        <Trigger Property="IsChecked" Value="{x:Null}">
                            <!--<Setter Property="Opacity" TargetName="innerElipse" Value="0"/>
                            <Setter Property="StrokeThickness" TargetName="outerElipse" Value="1"/>
                            <Setter Property="Fill" TargetName="outerElipse" Value="white"/>-->
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
 
    <!--#region TextBox Style-->
    <Style TargetType="TextBox">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate >
                    <Grid>
                        <Border x:Name="BackBorder" SnapsToDevicePixels="true" Background="{TemplateBinding Background}"
                            BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
                            <ScrollViewer x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsFocused" Value="True" >
                            <Setter Property="Background" TargetName="BackBorder" Value="#FFE5E6EB"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="TextBox.Foreground" Value="Gray"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <!--#endregion-->
 
    <!--#region ComboBox style-->
    <Style TargetType="ComboBox">
        <Setter Property="ItemContainerStyle">
            <Setter.Value>
                <!--ComBoxItem-->
                <Style TargetType="ComboBoxItem">
                    <Setter Property="MinHeight" Value="28"/>
                    <Setter Property="MinWidth" Value="60"/>
                    <Setter Property="Foreground" Value="Black"/>
                    <Setter Property="FontSize" Value="14"/>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="ComboBoxItem">
                                <Border Name="Back" Background="White"  BorderThickness="0" >
                                    <ContentPresenter ContentSource="{Binding Source}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0,0,0" ></ContentPresenter>
                                </Border>
                                <ControlTemplate.Triggers>
                                    <Trigger Property="IsSelected" Value="True">
                                        <Setter TargetName="Back" Property="Background" Value="{DynamicResource listSelectedBrush}"></Setter>
                                    </Trigger>
                                    <MultiTrigger>
                                        <MultiTrigger.Conditions>
                                            <Condition Property="IsMouseOver" Value="true" />
                                            <Condition Property="IsSelected" Value="false"/>
                                        </MultiTrigger.Conditions>
                                        <Setter TargetName="Back" Property="Background" Value="{DynamicResource blueBrush}"/>
                                        <Setter   Property="Foreground" Value="White" />
                                    </MultiTrigger>
 
                                    <!--下拉框背景色-->
                                    <!--<Trigger Property="IsHighlighted" Value="True">
                                        <Setter TargetName="Back" Property="Background" Value="LightGray"></Setter>
                                    </Trigger>-->
                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>
 
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ComboBox">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="7*"/>
                            <ColumnDefinition Width="3*" MaxWidth="20"/>
                        </Grid.ColumnDefinitions>
                        <Border Grid.Column="0"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    Background="{TemplateBinding Background}" >
                            <TextBox x:Name="myTxt" IsReadOnly="{TemplateBinding IsEditable}"
                                         Text="{TemplateBinding Text}"
                                         Background="{TemplateBinding Background}"
                                         BorderThickness="0" IsEnabled="{TemplateBinding IsEditable}"
                                         VerticalContentAlignment="Center" VerticalScrollBarVisibility="Disabled"
                                         FontSize="16"
                                         Foreground="Black"/>
                        </Border>
                        <Border Grid.Column="1" Margin="-1 0"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}" >
                            <ToggleButton Content="&#xeda2;" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                          ClickMode="Press" Background="{TemplateBinding Background}" Template="{DynamicResource MyToggleBtnStyle}"
                                          BorderBrush="{TemplateBinding BorderBrush}"/>
                        </Border>
                        <Popup Name="MyPopup" IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom" AllowsTransparency="True">
                            <Border MinWidth="{TemplateBinding ActualWidth}" MaxHeight="{TemplateBinding MaxDropDownHeight}" BorderBrush="LightGray" BorderThickness="1" >
                                <ScrollViewer MaxHeight="{TemplateBinding MaxDropDownHeight}" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
                                    <StackPanel Background="AliceBlue" IsItemsHost="True"/>
                                </ScrollViewer>
                            </Border>
                        </Popup>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
 
    <ControlTemplate x:Key="MyToggleBtnStyle" TargetType="ToggleButton">
        <Border Name="MyBorder"
                    Background="{TemplateBinding Background}"
                    BorderThickness="0" 
                    BorderBrush="{TemplateBinding BorderBrush}">
            <Path Name="MyPath"
                  StrokeThickness="2"
                  Stroke="Gray"
                      Height="8"
                      Width="15"
                      Data="M0,0 L6,5 L12,0"
                      Stretch="Fill">
            </Path>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter TargetName="MyBorder" Property="Opacity" Value="0.6"></Setter>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    <!--#endregion-->
</ResourceDictionary>