RoleLoginView.xaml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. <Window x:Class="DefaultEdit.Views.RoleLoginView"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6. xmlns:local="clr-namespace:DefaultEdit.Views"
  7. xmlns:prism="http://prismlibrary.com/"
  8. prism:ViewModelLocator.AutoWireViewModel="True"
  9. xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
  10. mc:Ignorable="d"
  11. FontFamily="微软雅黑"
  12. WindowStyle="None"
  13. Title="RoleLoginView" Height="360" Width="650">
  14. <WindowChrome.WindowChrome>
  15. <WindowChrome GlassFrameThickness="50"
  16. CaptionHeight="30"
  17. NonClientFrameEdges="Left,Bottom,Right"
  18. CornerRadius="20" />
  19. </WindowChrome.WindowChrome>
  20. <Window.Resources>
  21. <Style x:Key="buttonborder"
  22. TargetType="Border">
  23. <Setter Property="BorderThickness"
  24. Value="2" />
  25. <Setter Property="Background"
  26. Value="Transparent" />
  27. <Setter Property="VerticalAlignment"
  28. Value="Center" />
  29. <Setter Property="BorderBrush"
  30. Value="Transparent" />
  31. <Setter Property="CornerRadius"
  32. Value="5" />
  33. <Setter Property="Effect">
  34. <Setter.Value>
  35. <DropShadowEffect BlurRadius="10"
  36. Direction="1"
  37. ShadowDepth="0.5"
  38. Color="#2961AC" />
  39. </Setter.Value>
  40. </Setter>
  41. </Style>
  42. <!--ComboBox-->
  43. <!--ComBoBox项选中背景色-->
  44. <SolidColorBrush x:Key="ComboBoxSelectdBackground"
  45. Color="#ff8c69" />
  46. <!--ComBoBox项鼠标经过背景色-->
  47. <SolidColorBrush x:Key="ComboBoxMouseOverBackground"
  48. Color="#ff3030" />
  49. <!--ComBoBox项选中前景色-->
  50. <SolidColorBrush x:Key="ComboBoxSelectedForeground"
  51. Color="White" />
  52. <!--ComBoBox项鼠标经过前景色-->
  53. <SolidColorBrush x:Key="ComboBoxMouseOverForegrond"
  54. Color="White" />
  55. <ControlTemplate x:Key="ComboBoxToggleButton"
  56. TargetType="{x:Type ToggleButton}">
  57. <Grid Height="25"
  58. HorizontalAlignment="Stretch">
  59. <Grid.ColumnDefinitions>
  60. <ColumnDefinition Width="*" />
  61. <ColumnDefinition Width="30" />
  62. </Grid.ColumnDefinitions>
  63. <Border Background="White"
  64. Grid.ColumnSpan="2"
  65. Opacity="0" />
  66. <Path x:Name="Arrow"
  67. Grid.Column="1"
  68. Data="M 0 0 6 6 12 0 Z"
  69. VerticalAlignment="Center"
  70. HorizontalAlignment="Center"
  71. Stretch="None"
  72. Fill="#999" />
  73. </Grid>
  74. <ControlTemplate.Triggers>
  75. <Trigger Property="IsChecked"
  76. Value="true">
  77. <Setter TargetName="Arrow"
  78. Property="RenderTransform">
  79. <Setter.Value>
  80. <RotateTransform CenterX="6"
  81. CenterY="3"
  82. Angle="180"></RotateTransform>
  83. </Setter.Value>
  84. </Setter>
  85. <Setter TargetName="Arrow"
  86. Property="Margin"
  87. Value="0 0 0 2" />
  88. </Trigger>
  89. </ControlTemplate.Triggers>
  90. </ControlTemplate>
  91. <Style TargetType="{x:Type ComboBox}">
  92. <Setter Property="ItemContainerStyle">
  93. <Setter.Value>
  94. <Style TargetType="ComboBoxItem">
  95. <Setter Property="Height"
  96. Value="20" />
  97. <Setter Property="Template">
  98. <Setter.Value>
  99. <ControlTemplate TargetType="{x:Type ComboBoxItem}">
  100. <Grid Height="{TemplateBinding Height}"
  101. Width="{TemplateBinding Width}">
  102. <Border x:Name="_borderbg"
  103. Background="Transparent" />
  104. <TextBlock Margin="3 0 3 0"
  105. VerticalAlignment="Center"
  106. x:Name="_txt"
  107. Foreground="#333"
  108. Text="{Binding Content,RelativeSource={RelativeSource TemplatedParent}}" />
  109. <Border x:Name="_border"
  110. Background="White"
  111. Opacity="0" />
  112. </Grid>
  113. <ControlTemplate.Triggers>
  114. <Trigger Property="IsSelected"
  115. Value="true">
  116. <Setter TargetName="_borderbg"
  117. Property="Background"
  118. Value="{StaticResource ComboBoxSelectdBackground}" />
  119. <Setter TargetName="_txt"
  120. Property="Foreground"
  121. Value="{StaticResource ComboBoxSelectedForeground}" />
  122. </Trigger>
  123. <MultiTrigger>
  124. <MultiTrigger.Conditions>
  125. <Condition Property="IsSelected"
  126. Value="false" />
  127. <Condition Property="IsMouseOver"
  128. Value="true" />
  129. </MultiTrigger.Conditions>
  130. <Setter TargetName="_borderbg"
  131. Property="Background"
  132. Value="{StaticResource ComboBoxMouseOverBackground}" />
  133. <Setter TargetName="_txt"
  134. Property="Foreground"
  135. Value="{StaticResource ComboBoxMouseOverForegrond}" />
  136. </MultiTrigger>
  137. </ControlTemplate.Triggers>
  138. </ControlTemplate>
  139. </Setter.Value>
  140. </Setter>
  141. </Style>
  142. </Setter.Value>
  143. </Setter>
  144. <Setter Property="Template">
  145. <Setter.Value>
  146. <ControlTemplate TargetType="{x:Type ComboBox}">
  147. <Grid>
  148. <Grid.ColumnDefinitions>
  149. <ColumnDefinition Width="0.7*" />
  150. <ColumnDefinition Width="0.3*"
  151. MaxWidth="30" />
  152. </Grid.ColumnDefinitions>
  153. <Border Grid.Column="0"
  154. Grid.ColumnSpan="2"
  155. BorderThickness="1"
  156. BorderBrush="{TemplateBinding BorderBrush}"
  157. CornerRadius="1,0,0,1" />
  158. <ContentPresenter HorizontalAlignment="Left"
  159. Margin="3,3,0,3"
  160. x:Name="ContentSite"
  161. VerticalAlignment="Center"
  162. Content="{TemplateBinding SelectionBoxItem}"
  163. ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
  164. ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
  165. IsHitTestVisible="False" />
  166. <!--ToggleButton 已数据绑定到 ComboBox 本身以切换 IsDropDownOpen-->
  167. <ToggleButton Grid.Column="0"
  168. Grid.ColumnSpan="2"
  169. Template="{StaticResource ComboBoxToggleButton}"
  170. x:Name="ToggleButton"
  171. Focusable="false"
  172. IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
  173. ClickMode="Press" />
  174. <!--必须将 TextBox 命名为 PART_EditableTextBox,否则 ComboBox 将无法识别它-->
  175. <TextBox Visibility="Hidden"
  176. BorderThickness="0"
  177. Margin="2 0 0 0"
  178. x:Name="PART_EditableTextBox"
  179. VerticalAlignment="Center"
  180. Focusable="True"
  181. Background="Transparent"
  182. IsReadOnly="{TemplateBinding IsReadOnly}" />
  183. <!--Popup 可显示 ComboBox 中的项列表。IsOpen 已数据绑定到通过 ComboBoxToggleButton 来切换的 IsDropDownOpen-->
  184. <Popup IsOpen="{TemplateBinding IsDropDownOpen}"
  185. Placement="Bottom"
  186. x:Name="Popup"
  187. Focusable="False"
  188. AllowsTransparency="True"
  189. PopupAnimation="Slide">
  190. <Grid MaxHeight="150"
  191. MinWidth="{TemplateBinding ActualWidth}"
  192. x:Name="DropDown"
  193. SnapsToDevicePixels="True">
  194. <Border x:Name="DropDownBorder"
  195. BorderBrush="#e8e8e8"
  196. BorderThickness="1 0 1 1" />
  197. <ScrollViewer Margin="1"
  198. SnapsToDevicePixels="True"
  199. HorizontalScrollBarVisibility="Auto"
  200. VerticalScrollBarVisibility="Auto"
  201. CanContentScroll="True">
  202. <!--StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True-->
  203. <StackPanel IsItemsHost="True"
  204. KeyboardNavigation.DirectionalNavigation="Contained"
  205. Background="White" />
  206. </ScrollViewer>
  207. </Grid>
  208. </Popup>
  209. </Grid>
  210. <ControlTemplate.Triggers>
  211. <Trigger Property="IsEditable"
  212. Value="true">
  213. <Setter TargetName="PART_EditableTextBox"
  214. Property="Visibility"
  215. Value="Visible" />
  216. </Trigger>
  217. </ControlTemplate.Triggers>
  218. </ControlTemplate>
  219. </Setter.Value>
  220. </Setter>
  221. </Style>
  222. </Window.Resources>
  223. <Grid Background="Transparent">
  224. <Border BorderBrush="AliceBlue" BorderThickness="2" Margin="10" CornerRadius="10">
  225. <Border.Background>
  226. <LinearGradientBrush>
  227. <GradientStop Color="#95DDFD"
  228. Offset="0" />
  229. <GradientStop Color="#97B8FF"
  230. Offset="0.4" />
  231. <GradientStop Color="#2961AC"
  232. Offset="0.9" />
  233. </LinearGradientBrush>
  234. </Border.Background>
  235. <Grid Background="White" Opacity="0.8">
  236. <Grid.RowDefinitions>
  237. <RowDefinition Height="60"/>
  238. <RowDefinition Height="Auto"/>
  239. <RowDefinition Height="Auto"/>
  240. <RowDefinition />
  241. </Grid.RowDefinitions>
  242. <Grid Grid.Row="0">
  243. <Grid.ColumnDefinitions>
  244. <ColumnDefinition />
  245. <ColumnDefinition />
  246. </Grid.ColumnDefinitions>
  247. <StackPanel Orientation="Horizontal" Grid.Column="0">
  248. <Ellipse Fill="#8A2BE1"
  249. Width="50"
  250. Height="50"
  251. Stretch="Fill">
  252. </Ellipse>
  253. <TextBlock Text="EA时代天使"
  254. Foreground="Black"
  255. FontSize="25"
  256. Margin="10"
  257. FontWeight="Bold" />
  258. </StackPanel>
  259. <TextBlock Text="Login" Grid.Column="0"
  260. HorizontalAlignment="Left"
  261. Margin="5"
  262. VerticalAlignment="Center"
  263. FontSize="14" />
  264. <StackPanel Grid.Column="1" HorizontalAlignment="Right">
  265. <Border Style="{StaticResource buttonborder}">
  266. <Button Content="关闭"
  267. VerticalAlignment="Top"
  268. Foreground="Black"
  269. Padding="5"
  270. MinWidth="50"
  271. BorderBrush="Transparent"
  272. FontSize="15"
  273. Click="Button_Click"
  274. WindowChrome.IsHitTestVisibleInChrome="True"
  275. Background="Transparent" />
  276. </Border>
  277. </StackPanel>
  278. </Grid>
  279. <Grid Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center">
  280. <StackPanel>
  281. <TextBlock Text="登录"
  282. Foreground="Black"
  283. FontSize="25"
  284. FontWeight="Bold" />
  285. <TextBlock Text="Sign in"
  286. Foreground="Black"
  287. FontSize="25"
  288. Margin="0,0,0,10"
  289. FontWeight="Bold" />
  290. <TextBox x:Name="combox"
  291. Width="180"
  292. Height="30"
  293. Text="{Binding CurrRole}"
  294. />
  295. </StackPanel>
  296. </Grid>
  297. <Grid Grid.Row="2">
  298. <StackPanel VerticalAlignment="Bottom"
  299. HorizontalAlignment="Center"
  300. >
  301. <PasswordBox x:Name="PasswordBox"
  302. Margin="5,20,5,5"
  303. Width="180"
  304. Height="30"
  305. VerticalContentAlignment="Bottom"
  306. FontSize="20"
  307. FontWeight="Thin">
  308. <i:Interaction.Triggers>
  309. <i:EventTrigger EventName="PasswordChanged">
  310. <i:InvokeCommandAction Command="{Binding PasswordChangedCommand}"
  311. CommandParameter="{Binding ElementName=PasswordBox}" />
  312. </i:EventTrigger>
  313. </i:Interaction.Triggers>
  314. </PasswordBox>
  315. </StackPanel>
  316. </Grid>
  317. <Grid Grid.Row="3">
  318. <StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Center" Width="180">
  319. <TextBlock TextAlignment="Center"
  320. Background="{ Binding L_Brush}"
  321. Text="{Binding Loginstr}" FontSize="12" FontWeight="Bold" FontFamily="微软雅黑" Margin="50,0,50,10"/>
  322. <Border Background="#0A85D9" BorderBrush="Black" BorderThickness="1" CornerRadius="8">
  323. <Button Content="登录"
  324. Name="loginbtu"
  325. Background="Transparent"
  326. FontSize="20"
  327. Foreground="White"
  328. Margin="5"
  329. BorderThickness="0"
  330. Command="{Binding LogoutCommand}"
  331. CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"/>
  332. </Border>
  333. </StackPanel>
  334. </Grid>
  335. </Grid>
  336. </Border>
  337. </Grid>
  338. </Window>