RoleLoginView.xaml 19 KB

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