Skip to content

Commit b540efe

Browse files
committed
Update Generic.xaml
1 parent a51d993 commit b540efe

1 file changed

Lines changed: 126 additions & 82 deletions

File tree

  • src/WPFDevelopers.Samples.Shared/ExampleViews/LoginWindow

src/WPFDevelopers.Samples.Shared/ExampleViews/LoginWindow/Generic.xaml

Lines changed: 126 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,174 +1,218 @@
1-
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
1+
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
32
<ResourceDictionary.MergedDictionaries>
43
<ResourceDictionary>
5-
<!-- 按钮样式 -->
6-
<!-- 关闭按钮 -->
4+
<!-- 按钮样式 -->
5+
<!-- 关闭按钮 -->
76
<Style x:Key="CloseButtonStyle" TargetType="Button">
8-
<Setter Property="Opacity" Value="0.5"/>
9-
7+
<Setter Property="Opacity" Value="0.5" />
8+
109
<Setter Property="Template">
1110
<Setter.Value>
1211
<ControlTemplate TargetType="Button">
1312
<Border Name="Border" Background="Transparent">
14-
<Canvas Width="10" Height="10" ClipToBounds="True">
15-
<Line x:Name="Line01" Stroke="White" X1="0" Y1="0" X2="10" Y2="10"/>
16-
<Line x:Name="Line02" Stroke="White" X1="10" Y1="0" X2="0" Y2="10"/>
13+
<Canvas
14+
Width="10"
15+
Height="10"
16+
ClipToBounds="True">
17+
<Line
18+
x:Name="Line01"
19+
Stroke="White"
20+
X1="0"
21+
X2="10"
22+
Y1="0"
23+
Y2="10" />
24+
<Line
25+
x:Name="Line02"
26+
Stroke="White"
27+
X1="10"
28+
X2="0"
29+
Y1="0"
30+
Y2="10" />
1731
</Canvas>
1832
</Border>
19-
<!-- 触发器 -->
33+
<!-- 触发器 -->
2034
<ControlTemplate.Triggers>
2135
<Trigger Property="IsMouseOver" Value="True">
22-
<Setter Property="Opacity" Value="0.75"/>
36+
<Setter Property="Opacity" Value="0.75" />
2337
</Trigger>
2438
<Trigger Property="IsPressed" Value="True">
25-
<Setter Property="Opacity" Value="1"/>
39+
<Setter Property="Opacity" Value="1" />
2640
</Trigger>
2741
</ControlTemplate.Triggers>
2842
</ControlTemplate>
2943
</Setter.Value>
3044
</Setter>
3145
</Style>
3246

33-
<!-- 登录/注册按钮 -->
47+
<!-- 登录/注册按钮 -->
3448
<Style x:Key="LoginButtonStyle" TargetType="Button">
35-
<Setter Property="Foreground" Value="White"/>
36-
49+
<Setter Property="Foreground" Value="White" />
50+
3751
<Setter Property="Template">
3852
<Setter.Value>
3953
<ControlTemplate TargetType="Button">
4054
<Border x:Name="Border" Background="#4370F5">
41-
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
55+
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
4256
</Border>
43-
<!-- 触发器 -->
57+
<!-- 触发器 -->
4458
<ControlTemplate.Triggers>
45-
<!-- 鼠标悬停时 -->
59+
<!-- 鼠标悬停时 -->
4660
<Trigger Property="IsMouseOver" Value="True">
47-
<Setter TargetName="Border" Property="Background" Value="#5B84FE"/>
61+
<Setter TargetName="Border" Property="Background" Value="#5B84FE" />
4862
</Trigger>
49-
<!-- 鼠标按下时 -->
63+
<!-- 鼠标按下时 -->
5064
<Trigger Property="IsPressed" Value="True">
51-
<Setter TargetName="Border" Property="Background" Value="#3761DF"/>
65+
<Setter TargetName="Border" Property="Background" Value="#3761DF" />
5266
</Trigger>
53-
<!-- 禁用时 -->
67+
<!-- 禁用时 -->
5468
<Trigger Property="IsEnabled" Value="False">
55-
<Setter Property="Opacity" Value="0.3"/>
69+
<Setter Property="Opacity" Value="0.3" />
5670
</Trigger>
5771
</ControlTemplate.Triggers>
5872
</ControlTemplate>
5973
</Setter.Value>
6074
</Setter>
6175
</Style>
62-
<!-- 文本框样式 -->
76+
<!-- 文本框样式 -->
6377
<Style x:Key="TextBoxStyle" TargetType="TextBox">
64-
<!-- 文本色 -->
65-
<Setter Property="Foreground" Value="Black"/>
66-
<!-- 文本垂直居中 -->
67-
<Setter Property="VerticalContentAlignment" Value="Center"/>
68-
<!-- 模板 -->
78+
<!-- 文本色 -->
79+
<Setter Property="Foreground" Value="Black" />
80+
<!-- 文本垂直居中 -->
81+
<Setter Property="VerticalContentAlignment" Value="Center" />
82+
<!-- 模板 -->
6983
<Setter Property="Template">
7084
<Setter.Value>
7185
<ControlTemplate TargetType="TextBox">
72-
<!-- 外观 -->
73-
<Border x:Name="border" BorderBrush="#D9D9D9" BorderThickness="1" Background="Transparent">
74-
<ScrollViewer x:Name="PART_ContentHost" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
86+
<!-- 外观 -->
87+
<Border
88+
x:Name="border"
89+
Background="Transparent"
90+
BorderBrush="#D9D9D9"
91+
BorderThickness="1">
92+
<ScrollViewer
93+
x:Name="PART_ContentHost"
94+
HorizontalScrollBarVisibility="Hidden"
95+
VerticalScrollBarVisibility="Hidden" />
7596
</Border>
76-
<!-- 触发器 -->
97+
<!-- 触发器 -->
7798
<ControlTemplate.Triggers>
78-
<!-- 禁用 -->
99+
<!-- 禁用 -->
79100
<Trigger Property="IsEnabled" Value="false">
80-
<Setter Property="Opacity" TargetName="border" Value="0.4"/>
101+
<Setter TargetName="border" Property="Opacity" Value="0.4" />
81102
</Trigger>
82-
<!-- 鼠标悬停 -->
103+
<!-- 鼠标悬停 -->
83104
<Trigger Property="IsMouseOver" Value="true">
84-
<Setter Property="BorderBrush" TargetName="border" Value="#B4B4B4"/>
105+
<Setter TargetName="border" Property="BorderBrush" Value="#B4B4B4" />
85106
</Trigger>
86-
<!-- 获取焦点 -->
107+
<!-- 获取焦点 -->
87108
<Trigger Property="IsKeyboardFocused" Value="true">
88-
<Setter Property="BorderBrush" TargetName="border" Value="#4370F5"/>
109+
<Setter TargetName="border" Property="BorderBrush" Value="#4370F5" />
89110
</Trigger>
90111
</ControlTemplate.Triggers>
91112
</ControlTemplate>
92113
</Setter.Value>
93114
</Setter>
94115
</Style>
95-
<!-- 密码框样式 -->
116+
<!-- 密码框样式 -->
96117
<Style x:Key="PasswordBoxStyle" TargetType="PasswordBox">
97-
<!-- 文本色 -->
98-
<Setter Property="Foreground" Value="Black"/>
99-
<!-- 文本垂直居中 -->
100-
<Setter Property="VerticalContentAlignment" Value="Center"/>
101-
<Setter Property="PasswordChar" Value=""/>
102-
<!-- 模板 -->
118+
<!-- 文本色 -->
119+
<Setter Property="Foreground" Value="Black" />
120+
<!-- 文本垂直居中 -->
121+
<Setter Property="VerticalContentAlignment" Value="Center" />
122+
<Setter Property="PasswordChar" Value="" />
123+
<!-- 模板 -->
103124
<Setter Property="Template">
104125
<Setter.Value>
105126
<ControlTemplate TargetType="PasswordBox">
106-
<!-- 外观 -->
107-
<Border x:Name="border" BorderBrush="#D9D9D9" BorderThickness="1" Background="Transparent">
108-
<ScrollViewer x:Name="PART_ContentHost" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
127+
<!-- 外观 -->
128+
<Border
129+
x:Name="border"
130+
Background="Transparent"
131+
BorderBrush="#D9D9D9"
132+
BorderThickness="1">
133+
<ScrollViewer
134+
x:Name="PART_ContentHost"
135+
HorizontalScrollBarVisibility="Hidden"
136+
VerticalScrollBarVisibility="Hidden" />
109137
</Border>
110-
<!-- 触发器 -->
138+
<!-- 触发器 -->
111139
<ControlTemplate.Triggers>
112-
<!-- 禁用 -->
140+
<!-- 禁用 -->
113141
<Trigger Property="IsEnabled" Value="false">
114-
<Setter Property="Opacity" TargetName="border" Value="0.4"/>
142+
<Setter TargetName="border" Property="Opacity" Value="0.4" />
115143
</Trigger>
116-
<!-- 鼠标悬停 -->
144+
<!-- 鼠标悬停 -->
117145
<Trigger Property="IsMouseOver" Value="true">
118-
<Setter Property="BorderBrush" TargetName="border" Value="#B4B4B4"/>
146+
<Setter TargetName="border" Property="BorderBrush" Value="#B4B4B4" />
119147
</Trigger>
120-
<!-- 获取焦点 -->
148+
<!-- 获取焦点 -->
121149
<Trigger Property="IsKeyboardFocused" Value="true">
122-
<Setter Property="BorderBrush" TargetName="border" Value="#4370F5"/>
150+
<Setter TargetName="border" Property="BorderBrush" Value="#4370F5" />
123151
</Trigger>
124152
</ControlTemplate.Triggers>
125153
</ControlTemplate>
126154
</Setter.Value>
127155
</Setter>
128156
</Style>
129-
<!-- 窗口样式 -->
157+
<!-- 窗口样式 -->
130158
<Style x:Key="NormalWindow" TargetType="Window">
131-
<Setter Property="Background" Value="#80222324"/>
132-
<Setter Property="FontFamily" Value="NSimSun"/>
133-
<Setter Property="FontSize" Value="12"/>
134-
<Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
135-
<Setter Property="SnapsToDevicePixels" Value="True"/>
136-
<!-- 模板 -->
159+
<Setter Property="Background" Value="#80222324" />
160+
<Setter Property="FontFamily" Value="NSimSun" />
161+
<Setter Property="FontSize" Value="12" />
162+
<Setter Property="TextOptions.TextFormattingMode" Value="Display" />
163+
<Setter Property="SnapsToDevicePixels" Value="True" />
164+
<!-- 模板 -->
137165
<Setter Property="Template">
138166
<Setter.Value>
139167
<ControlTemplate TargetType="Window">
140-
<!-- 外观 -->
168+
<!-- 外观 -->
141169
<Grid>
142-
<!-- 分区 -->
170+
<!-- 分区 -->
143171
<Grid.RowDefinitions>
144-
<!-- 标题栏 -->
145-
<RowDefinition Height="100"/>
146-
<!-- 客户区 -->
172+
<!-- 标题栏 -->
173+
<RowDefinition Height="100" />
174+
<!-- 客户区 -->
147175
<RowDefinition />
148176
</Grid.RowDefinitions>
149-
<!-- 第一块:标题栏 -->
177+
<!-- 第一块:标题栏 -->
150178
<Grid>
151-
<!-- 背景色 -->
152-
<Grid Height="200" VerticalAlignment="Center" Opacity="0.9">
179+
<!-- 背景色 -->
180+
<Grid
181+
Height="200"
182+
VerticalAlignment="Center"
183+
Opacity="0.9">
153184
<Grid.Background>
154185
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
155-
<GradientStop Offset="0" Color="#4370F5"/>
156-
<GradientStop Offset="1" Color="#AE088D"/>
186+
<GradientStop Offset="0" Color="#4370F5" />
187+
<GradientStop Offset="1" Color="#AE088D" />
157188
</LinearGradientBrush>
158189
</Grid.Background>
159190
</Grid>
160-
<!-- 背景图 -->
161-
<Image Source="pack://application:,,,/WPFDevelopers.Samples;component/Resources/Assets/Background.png" Width="360" VerticalAlignment="Bottom"/>
162-
<!-- 标识 -->
163-
<Image Source="pack://application:,,,/WPFDevelopers.Samples;component/Resources/Assets/Logo.png" Width="114" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="20,20,0,0"/>
164-
<!-- 关闭按钮 -->
165-
<Button x:Name="CloseButton" Width="30" Height="30" HorizontalAlignment="Right" VerticalAlignment="Top"
166-
Style="{StaticResource CloseButtonStyle}"/>
191+
<!-- 背景图 -->
192+
<Image
193+
Width="360"
194+
VerticalAlignment="Bottom"
195+
Source="pack://application:,,,/WPFDevelopers.Samples;component/Resources/Assets/Background.png" />
196+
<!-- 标识 -->
197+
<Image
198+
Width="114"
199+
Margin="20,20,0,0"
200+
HorizontalAlignment="Left"
201+
VerticalAlignment="Top"
202+
Source="pack://application:,,,/WPFDevelopers.Samples;component/Resources/Assets/Logo.png" />
203+
<!-- 关闭按钮 -->
204+
<Button
205+
x:Name="CloseButton"
206+
Width="30"
207+
Height="30"
208+
HorizontalAlignment="Right"
209+
VerticalAlignment="Top"
210+
Style="{StaticResource CloseButtonStyle}" />
167211
</Grid>
168-
<!-- 第二块:客户区 -->
212+
<!-- 第二块:客户区 -->
169213
<Grid Grid.Row="1" Background="White">
170214
<AdornerDecorator>
171-
<ContentPresenter/>
215+
<ContentPresenter />
172216
</AdornerDecorator>
173217
</Grid>
174218
</Grid>

0 commit comments

Comments
 (0)