终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

531 line
40 KiB

  1. <UserControl x:Class="FryPot_DosingSystem.View.UserManageView"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:FryPot_DosingSystem.View"
  7. xmlns:vm="clr-namespace:FryPot_DosingSystem.ViewModel"
  8. mc:Ignorable="d"
  9. d:DesignHeight="450" d:DesignWidth="800"
  10. xmlns:theme="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero2">
  11. <!--<UserControl.DataContext>
  12. <vm:UserManageViewModel/>
  13. </UserControl.DataContext>-->
  14. <UserControl.Resources>
  15. <Style x:Key="dgCell" TargetType="TextBlock">
  16. <Setter Property="HorizontalAlignment" Value="Center"/>
  17. <Setter Property="VerticalAlignment" Value="Center"/>
  18. <Setter Property="Background" Value="Transparent"/>
  19. </Style>
  20. <Style x:Key="btnStyle" TargetType="Button">
  21. <Setter Property="Width" Value="auto"/>
  22. <Setter Property="FontSize" Value="16"/>
  23. <Setter Property="Foreground" Value="SkyBlue"/>
  24. <Setter Property="Background" Value="Transparent"/>
  25. <Setter Property="BorderBrush" Value="SkyBlue"/>
  26. </Style>
  27. <Style x:Key="textboxStyle" TargetType="TextBox">
  28. <Setter Property="Background" Value="Transparent"/>
  29. <Setter Property="Foreground" Value="SkyBlue"/>
  30. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  31. <Setter Property="VerticalContentAlignment" Value="Center"/>
  32. <Setter Property="FontSize" Value="16"/>
  33. <Setter Property="BorderThickness" Value="0"/>
  34. <Setter Property="CaretBrush" Value="LightBlue"/>
  35. <Style.Triggers>
  36. <Trigger Property="IsFocused" Value="True">
  37. <Setter Property="Cursor" Value="Arrow"/>
  38. </Trigger>
  39. </Style.Triggers>
  40. </Style>
  41. <Style TargetType="DataGrid" x:Key="dataGrid">
  42. <!--网格线颜色-->
  43. <Setter Property="CanUserResizeColumns" Value="false"/>
  44. <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Hidden"></Setter>
  45. <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden"></Setter>
  46. <Setter Property="HeadersVisibility" Value="Column"/>
  47. <Setter Property="HorizontalGridLinesBrush">
  48. <Setter.Value>
  49. <SolidColorBrush Color="#FF2AB2E7"/>
  50. </Setter.Value>
  51. </Setter>
  52. <Setter Property="VerticalGridLinesBrush">
  53. <Setter.Value>
  54. <SolidColorBrush Color="#FF2AB2E7"/>
  55. </Setter.Value>
  56. </Setter>
  57. </Style>
  58. <Style x:Key="columsHeader" TargetType="DataGridColumnHeader">
  59. <Setter Property="HorizontalContentAlignment" Value="Center"></Setter>
  60. <Setter Property="VerticalAlignment" Value="Center"/>
  61. <Setter Property="Foreground" Value="White"></Setter>
  62. <Setter Property="Background" Value="#FF2AB2E7"/>
  63. <Setter Property="BorderThickness" Value="1"></Setter>
  64. <Setter Property="BorderBrush" Value="white"></Setter>
  65. <Setter Property="Height" Value="30"/>
  66. <Setter Property="FontSize" Value="16"/>
  67. <Setter Property="FontWeight" Value="Heavy"/>
  68. <Setter Property="Margin" Value="-1,-1,-1,-1"/>
  69. </Style>
  70. <Style x:Key="rowStyle" TargetType="DataGridRow">
  71. <Setter Property="Height" Value="35"/>
  72. <Setter Property="Foreground" Value="SkyBlue"/>
  73. <Style.Triggers>
  74. <Trigger Property="AlternationIndex" Value="0">
  75. <Setter Property="Background" Value="Transparent" />
  76. </Trigger>
  77. <Trigger Property="AlternationIndex" Value="1">
  78. <Setter Property="Background" Value="Transparent" />
  79. </Trigger>
  80. <Trigger Property="IsMouseOver" Value="True">
  81. <Setter Property="Background" Value="#000066" />
  82. </Trigger>
  83. </Style.Triggers>
  84. </Style>
  85. <Style x:Key="cellStyle" TargetType="DataGridCell">
  86. <Style.Triggers>
  87. <Trigger Property="IsSelected" Value="True">
  88. <Setter Property="Background" Value="Transparent"/>
  89. <Setter Property="Foreground"
  90. Value="SkyBlue"/>
  91. </Trigger>
  92. <Trigger Property="IsSelected" Value="false">
  93. <Setter Property="Background" Value="Transparent"/>
  94. <Setter Property="Foreground"
  95. Value="SkyBlue"/>
  96. </Trigger>
  97. </Style.Triggers>
  98. </Style>
  99. <LinearGradientBrush x:Key="Button.Static.Background" EndPoint="0,1" StartPoint="0,0">
  100. <GradientStop Color="Transparent" Offset="0.0"/>
  101. <GradientStop Color="Transparent" Offset="1.0"/>
  102. </LinearGradientBrush>
  103. <SolidColorBrush x:Key="Button.MouseOver.Background" Color="#FFBEE6FD"/>
  104. <SolidColorBrush x:Key="Button.MouseOver.Border" Color="#FF3C7FB1"/>
  105. <SolidColorBrush x:Key="Button.Pressed.Background" Color="#FFC4E5F6"/>
  106. <SolidColorBrush x:Key="Button.Pressed.Border" Color="#FF2C628B"/>
  107. <SolidColorBrush x:Key="Button.Disabled.Background" Color="#FFF4F4F4"/>
  108. <SolidColorBrush x:Key="Button.Disabled.Border" Color="#FFADB2B5"/>
  109. <SolidColorBrush x:Key="Button.Disabled.Foreground" Color="#FF838383"/>
  110. <ControlTemplate x:Key="ButtonTemplate1" TargetType="{x:Type ButtonBase}">
  111. <Border x:Name="border" Background="{StaticResource Button.Static.Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true">
  112. <ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  113. </Border>
  114. <ControlTemplate.Triggers>
  115. <Trigger Property="Button.IsDefaulted" Value="true">
  116. <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
  117. </Trigger>
  118. <Trigger Property="IsMouseOver" Value="true">
  119. <!--<Setter Property="Background" TargetName="border" Value="#000066"/>-->
  120. <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.MouseOver.Border}"/>
  121. </Trigger>
  122. <Trigger Property="IsPressed" Value="true">
  123. <Setter Property="Background" TargetName="border" Value="{StaticResource Button.Pressed.Background}"/>
  124. <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Pressed.Border}"/>
  125. </Trigger>
  126. <Trigger Property="IsEnabled" Value="false">
  127. <Setter Property="Background" TargetName="border" Value="{StaticResource Button.Disabled.Background}"/>
  128. <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Disabled.Border}"/>
  129. <Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{StaticResource Button.Disabled.Foreground}"/>
  130. </Trigger>
  131. </ControlTemplate.Triggers>
  132. </ControlTemplate>
  133. <LinearGradientBrush x:Key="ComboBox.Static.Background" EndPoint="0,1" StartPoint="0,0">
  134. <GradientStop Color="Transparent" Offset="0.0"/>
  135. <GradientStop Color="Transparent" Offset="1.0"/>
  136. </LinearGradientBrush>
  137. <SolidColorBrush x:Key="ComboBox.Static.Border" Color="#FFACACAC"/>
  138. <SolidColorBrush x:Key="ComboBox.Static.Glyph" Color="#FF2AB2E7"/>
  139. <SolidColorBrush x:Key="ComboBox.Static.Editable.Background" Color="Transparent"/>
  140. <SolidColorBrush x:Key="ComboBox.Static.Editable.Border" Color="#FFABADB3"/>
  141. <SolidColorBrush x:Key="ComboBox.Static.Editable.Button.Background" Color="Transparent"/>
  142. <SolidColorBrush x:Key="ComboBox.Static.Editable.Button.Border" Color="Transparent"/>
  143. <LinearGradientBrush x:Key="ComboBox.MouseOver.Background" EndPoint="0,1" StartPoint="0,0">
  144. <GradientStop Color="Transparent" Offset="0.0"/>
  145. <GradientStop Color="Transparent" Offset="1.0"/>
  146. </LinearGradientBrush>
  147. <SolidColorBrush x:Key="ComboBox.MouseOver.Border" Color="#FF7EB4EA"/>
  148. <SolidColorBrush x:Key="ComboBox.MouseOver.Glyph" Color="#FF000000"/>
  149. <SolidColorBrush x:Key="ComboBox.MouseOver.Editable.Background" Color="Transparent"/>
  150. <SolidColorBrush x:Key="ComboBox.MouseOver.Editable.Border" Color="#FF7EB4EA"/>
  151. <LinearGradientBrush x:Key="ComboBox.MouseOver.Editable.Button.Background" EndPoint="0,1" StartPoint="0,0">
  152. <GradientStop Color="Transparent" Offset="0.0"/>
  153. <GradientStop Color="Transparent" Offset="1.0"/>
  154. </LinearGradientBrush>
  155. <SolidColorBrush x:Key="ComboBox.MouseOver.Editable.Button.Border" Color="#FF7EB4EA"/>
  156. <LinearGradientBrush x:Key="ComboBox.Pressed.Background" EndPoint="0,1" StartPoint="0,0">
  157. <GradientStop Color="#FFDAECFC" Offset="0.0"/>
  158. <GradientStop Color="#FFC4E0FC" Offset="1.0"/>
  159. </LinearGradientBrush>
  160. <SolidColorBrush x:Key="ComboBox.Pressed.Border" Color="#FF569DE5"/>
  161. <SolidColorBrush x:Key="ComboBox.Pressed.Glyph" Color="#FF000000"/>
  162. <SolidColorBrush x:Key="ComboBox.Pressed.Editable.Background" Color="#FFFFFFFF"/>
  163. <SolidColorBrush x:Key="ComboBox.Pressed.Editable.Border" Color="#FF569DE5"/>
  164. <LinearGradientBrush x:Key="ComboBox.Pressed.Editable.Button.Background" EndPoint="0,1" StartPoint="0,0">
  165. <GradientStop Color="#FFDAEBFC" Offset="0.0"/>
  166. <GradientStop Color="#FFC4E0FC" Offset="1.0"/>
  167. </LinearGradientBrush>
  168. <SolidColorBrush x:Key="ComboBox.Pressed.Editable.Button.Border" Color="#FF569DE5"/>
  169. <SolidColorBrush x:Key="ComboBox.Disabled.Background" Color="#FFF0F0F0"/>
  170. <SolidColorBrush x:Key="ComboBox.Disabled.Border" Color="#FFD9D9D9"/>
  171. <SolidColorBrush x:Key="ComboBox.Disabled.Glyph" Color="#FFBFBFBF"/>
  172. <SolidColorBrush x:Key="ComboBox.Disabled.Editable.Background" Color="#FFFFFFFF"/>
  173. <SolidColorBrush x:Key="ComboBox.Disabled.Editable.Border" Color="#FFBFBFBF"/>
  174. <SolidColorBrush x:Key="ComboBox.Disabled.Editable.Button.Background" Color="Transparent"/>
  175. <SolidColorBrush x:Key="ComboBox.Disabled.Editable.Button.Border" Color="Transparent"/>
  176. <Style x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
  177. <Setter Property="OverridesDefaultStyle" Value="true"/>
  178. <Setter Property="IsTabStop" Value="false"/>
  179. <Setter Property="Focusable" Value="false"/>
  180. <Setter Property="ClickMode" Value="Press"/>
  181. <Setter Property="Template">
  182. <Setter.Value>
  183. <ControlTemplate TargetType="{x:Type ToggleButton}">
  184. <Border x:Name="templateRoot" Background="{StaticResource ComboBox.Static.Background}" BorderBrush="{StaticResource ComboBox.Static.Border}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true">
  185. <Border x:Name="splitBorder" BorderBrush="Transparent" BorderThickness="1" HorizontalAlignment="Right" Margin="0" SnapsToDevicePixels="true" Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}">
  186. <Path x:Name="arrow" Data="F1 M 0,0 L 2.667,2.66665 L 5.3334,0 L 5.3334,-1.78168 L 2.6667,0.88501 L0,-1.78168 L0,0 Z" Fill="{StaticResource ComboBox.Static.Glyph}" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center"/>
  187. </Border>
  188. </Border>
  189. <ControlTemplate.Triggers>
  190. <MultiDataTrigger>
  191. <MultiDataTrigger.Conditions>
  192. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/>
  193. <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="false"/>
  194. <Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="false"/>
  195. <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="true"/>
  196. </MultiDataTrigger.Conditions>
  197. <Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Static.Editable.Background}"/>
  198. <Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Static.Editable.Border}"/>
  199. <Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.Static.Editable.Button.Background}"/>
  200. <Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.Static.Editable.Button.Border}"/>
  201. </MultiDataTrigger>
  202. <Trigger Property="IsMouseOver" Value="true">
  203. <Setter Property="Fill" TargetName="arrow" Value="{StaticResource ComboBox.MouseOver.Glyph}"/>
  204. </Trigger>
  205. <MultiDataTrigger>
  206. <MultiDataTrigger.Conditions>
  207. <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true"/>
  208. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false"/>
  209. </MultiDataTrigger.Conditions>
  210. <Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Background}"/>
  211. <Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Border}"/>
  212. </MultiDataTrigger>
  213. <MultiDataTrigger>
  214. <MultiDataTrigger.Conditions>
  215. <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true"/>
  216. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/>
  217. </MultiDataTrigger.Conditions>
  218. <Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Editable.Background}"/>
  219. <Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Editable.Border}"/>
  220. <Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.MouseOver.Editable.Button.Background}"/>
  221. <Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.MouseOver.Editable.Button.Border}"/>
  222. </MultiDataTrigger>
  223. <Trigger Property="IsPressed" Value="true">
  224. <Setter Property="Fill" TargetName="arrow" Value="{StaticResource ComboBox.Pressed.Glyph}"/>
  225. </Trigger>
  226. <MultiDataTrigger>
  227. <MultiDataTrigger.Conditions>
  228. <Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="true"/>
  229. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false"/>
  230. </MultiDataTrigger.Conditions>
  231. <Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Background}"/>
  232. <Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Border}"/>
  233. </MultiDataTrigger>
  234. <MultiDataTrigger>
  235. <MultiDataTrigger.Conditions>
  236. <Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="true"/>
  237. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/>
  238. </MultiDataTrigger.Conditions>
  239. <Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Editable.Background}"/>
  240. <Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Editable.Border}"/>
  241. <Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.Pressed.Editable.Button.Background}"/>
  242. <Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.Pressed.Editable.Button.Border}"/>
  243. </MultiDataTrigger>
  244. <Trigger Property="IsEnabled" Value="false">
  245. <Setter Property="Fill" TargetName="arrow" Value="{StaticResource ComboBox.Disabled.Glyph}"/>
  246. </Trigger>
  247. <MultiDataTrigger>
  248. <MultiDataTrigger.Conditions>
  249. <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false"/>
  250. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false"/>
  251. </MultiDataTrigger.Conditions>
  252. <Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Background}"/>
  253. <Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Border}"/>
  254. </MultiDataTrigger>
  255. <MultiDataTrigger>
  256. <MultiDataTrigger.Conditions>
  257. <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false"/>
  258. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/>
  259. </MultiDataTrigger.Conditions>
  260. <Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Editable.Background}"/>
  261. <Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Editable.Border}"/>
  262. <Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.Disabled.Editable.Button.Background}"/>
  263. <Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.Disabled.Editable.Button.Border}"/>
  264. </MultiDataTrigger>
  265. </ControlTemplate.Triggers>
  266. </ControlTemplate>
  267. </Setter.Value>
  268. </Setter>
  269. </Style>
  270. <Style x:Key="FocusVisual">
  271. <Setter Property="Control.Template">
  272. <Setter.Value>
  273. <ControlTemplate>
  274. <Rectangle Margin="2" StrokeDashArray="1 2" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" SnapsToDevicePixels="true" StrokeThickness="1"/>
  275. </ControlTemplate>
  276. </Setter.Value>
  277. </Setter>
  278. </Style>
  279. <SolidColorBrush x:Key="TextBox.Static.Background" Color="#FFFFFFFF"/>
  280. <Style x:Key="ComboBoxEditableTextBox" TargetType="{x:Type TextBox}">
  281. <Setter Property="OverridesDefaultStyle" Value="true"/>
  282. <Setter Property="AllowDrop" Value="true"/>
  283. <Setter Property="MinWidth" Value="0"/>
  284. <Setter Property="MinHeight" Value="0"/>
  285. <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
  286. <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
  287. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  288. <Setter Property="Template">
  289. <Setter.Value>
  290. <ControlTemplate TargetType="{x:Type TextBox}">
  291. <ScrollViewer x:Name="PART_ContentHost" Background="Transparent" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
  292. </ControlTemplate>
  293. </Setter.Value>
  294. </Setter>
  295. </Style>
  296. <ControlTemplate x:Key="ComboBoxEditableTemplate" TargetType="{x:Type ComboBox}">
  297. <Grid x:Name="templateRoot" SnapsToDevicePixels="true">
  298. <Grid.ColumnDefinitions>
  299. <ColumnDefinition Width="*"/>
  300. <ColumnDefinition MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Width="0"/>
  301. </Grid.ColumnDefinitions>
  302. <Popup x:Name="PART_Popup" AllowsTransparency="true" Grid.ColumnSpan="2" IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}">
  303. <theme:SystemDropShadowChrome x:Name="shadow" Color="Transparent" MinWidth="{Binding ActualWidth, ElementName=templateRoot}" MaxHeight="{TemplateBinding MaxDropDownHeight}">
  304. <Border x:Name="dropDownBorder" Background="Transparent" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1">
  305. <ScrollViewer x:Name="DropDownScrollViewer">
  306. <Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled">
  307. <Canvas x:Name="canvas" HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">
  308. <Rectangle x:Name="opaqueRect" Fill="{Binding Background, ElementName=dropDownBorder}" Height="{Binding ActualHeight, ElementName=dropDownBorder}" Width="{Binding ActualWidth, ElementName=dropDownBorder}"/>
  309. </Canvas>
  310. <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
  311. </Grid>
  312. </ScrollViewer>
  313. </Border>
  314. </theme:SystemDropShadowChrome>
  315. </Popup>
  316. <ToggleButton x:Name="toggleButton" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="2" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ComboBoxToggleButton}"/>
  317. <Border x:Name="border" Background="{StaticResource TextBox.Static.Background}" Margin="{TemplateBinding BorderThickness}">
  318. <TextBox x:Name="PART_EditableTextBox" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}" Margin="{TemplateBinding Padding}" Style="{StaticResource ComboBoxEditableTextBox}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
  319. </Border>
  320. </Grid>
  321. <ControlTemplate.Triggers>
  322. <Trigger Property="IsEnabled" Value="false">
  323. <Setter Property="Opacity" TargetName="border" Value="0.56"/>
  324. </Trigger>
  325. <Trigger Property="IsKeyboardFocusWithin" Value="true">
  326. <Setter Property="Foreground" Value="Black"/>
  327. </Trigger>
  328. <Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
  329. <Setter Property="Margin" TargetName="shadow" Value="0,0,5,5"/>
  330. <Setter Property="Color" TargetName="shadow" Value="#71000000"/>
  331. </Trigger>
  332. <Trigger Property="HasItems" Value="false">
  333. <Setter Property="Height" TargetName="dropDownBorder" Value="95"/>
  334. </Trigger>
  335. <MultiTrigger>
  336. <MultiTrigger.Conditions>
  337. <Condition Property="IsGrouping" Value="true"/>
  338. <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/>
  339. </MultiTrigger.Conditions>
  340. <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
  341. </MultiTrigger>
  342. <Trigger Property="ScrollViewer.CanContentScroll" SourceName="DropDownScrollViewer" Value="false">
  343. <Setter Property="Canvas.Top" TargetName="opaqueRect" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}"/>
  344. <Setter Property="Canvas.Left" TargetName="opaqueRect" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}"/>
  345. </Trigger>
  346. </ControlTemplate.Triggers>
  347. </ControlTemplate>
  348. <ControlTemplate x:Key="ComboBoxTemplate" TargetType="{x:Type ComboBox}">
  349. <Grid x:Name="templateRoot" SnapsToDevicePixels="true">
  350. <Grid.ColumnDefinitions>
  351. <ColumnDefinition Width="*"/>
  352. <ColumnDefinition MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Width="0"/>
  353. </Grid.ColumnDefinitions>
  354. <Popup x:Name="PART_Popup" AllowsTransparency="true" Grid.ColumnSpan="2" IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="1" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}">
  355. <theme:SystemDropShadowChrome x:Name="shadow" Color="Transparent" MinWidth="{Binding ActualWidth, ElementName=templateRoot}" MaxHeight="{TemplateBinding MaxDropDownHeight}">
  356. <Border x:Name="dropDownBorder" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1">
  357. <ScrollViewer x:Name="DropDownScrollViewer">
  358. <Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled">
  359. <Canvas x:Name="canvas" HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">
  360. <Rectangle x:Name="opaqueRect" Fill="{Binding Background, ElementName=dropDownBorder}" Height="{Binding ActualHeight, ElementName=dropDownBorder}" Width="{Binding ActualWidth, ElementName=dropDownBorder}"/>
  361. </Canvas>
  362. <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
  363. </Grid>
  364. </ScrollViewer>
  365. </Border>
  366. </theme:SystemDropShadowChrome>
  367. </Popup>
  368. <ToggleButton x:Name="toggleButton" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="2" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ComboBoxToggleButton}"/>
  369. <ContentPresenter x:Name="contentPresenter" ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" Content="{TemplateBinding SelectionBoxItem}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" IsHitTestVisible="false" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  370. </Grid>
  371. <ControlTemplate.Triggers>
  372. <Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
  373. <Setter Property="Margin" TargetName="shadow" Value="0,0,5,5"/>
  374. <Setter Property="Color" TargetName="shadow" Value="#71000000"/>
  375. </Trigger>
  376. <Trigger Property="HasItems" Value="false">
  377. <Setter Property="Height" TargetName="dropDownBorder" Value="95"/>
  378. </Trigger>
  379. <MultiTrigger>
  380. <MultiTrigger.Conditions>
  381. <Condition Property="IsGrouping" Value="true"/>
  382. <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/>
  383. </MultiTrigger.Conditions>
  384. <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
  385. </MultiTrigger>
  386. <Trigger Property="ScrollViewer.CanContentScroll" SourceName="DropDownScrollViewer" Value="false">
  387. <Setter Property="Canvas.Top" TargetName="opaqueRect" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}"/>
  388. <Setter Property="Canvas.Left" TargetName="opaqueRect" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}"/>
  389. </Trigger>
  390. </ControlTemplate.Triggers>
  391. </ControlTemplate>
  392. <Style x:Key="ComboBoxStyle1" TargetType="{x:Type ComboBox}">
  393. <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
  394. <Setter Property="Background" Value="{StaticResource ComboBox.Static.Background}"/>
  395. <Setter Property="BorderBrush" Value="{StaticResource ComboBox.Static.Border}"/>
  396. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
  397. <Setter Property="BorderThickness" Value="1"/>
  398. <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
  399. <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
  400. <Setter Property="Padding" Value="6,3,5,3"/>
  401. <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
  402. <Setter Property="ScrollViewer.PanningMode" Value="Both"/>
  403. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  404. <Setter Property="Template" Value="{StaticResource ComboBoxTemplate}"/>
  405. <Style.Triggers>
  406. <Trigger Property="IsEditable" Value="true">
  407. <Setter Property="IsTabStop" Value="false"/>
  408. <Setter Property="Padding" Value="2"/>
  409. <Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}"/>
  410. </Trigger>
  411. </Style.Triggers>
  412. </Style>
  413. </UserControl.Resources>
  414. <Grid>
  415. <ScrollViewer VerticalScrollBarVisibility="Hidden">
  416. <DataGrid ItemsSource="{Binding usersInfo}" GridLinesVisibility="All" Background="Transparent"
  417. AutoGenerateColumns="False"
  418. IsReadOnly="False" Style="{StaticResource dataGrid }"
  419. ColumnHeaderStyle="{StaticResource columsHeader}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}">
  420. <DataGrid.Columns>
  421. <!--<DataGridTemplateColumn Width="0.2*">
  422. <DataGridTemplateColumn.Header>
  423. <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" >
  424. <TextBlock FontFamily="../Resources/fonts/#iconfont" Foreground="Orange" Text="&#xe6a0;" FontSize="24" VerticalAlignment="Center" Margin="0,0,8,0"/>
  425. <TextBlock Text="Account" />
  426. </StackPanel>
  427. </DataGridTemplateColumn.Header>
  428. <DataGridTemplateColumn.CellTemplate>
  429. <DataTemplate>
  430. <TextBox Text="{Binding UserName}" Style="{StaticResource textboxStyle}"></TextBox>
  431. </DataTemplate>
  432. </DataGridTemplateColumn.CellTemplate>
  433. </DataGridTemplateColumn>-->
  434. <DataGridTextColumn FontSize="16" IsReadOnly="false" Width="0.2*" Binding="{Binding UserName}" ElementStyle="{StaticResource dgCell}">
  435. <DataGridTextColumn.Header>
  436. <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
  437. <TextBlock FontFamily="../Resources/fonts/#iconfont" Foreground="Orange" Text="&#xe6a0;" FontSize="18" VerticalAlignment="Center" Margin="0,0,8,0"/>
  438. <TextBlock Text="Account" />
  439. </StackPanel>
  440. </DataGridTextColumn.Header>
  441. </DataGridTextColumn>
  442. <!--<DataGridTemplateColumn Width="0.2*">
  443. <DataGridTemplateColumn.Header>
  444. <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" >
  445. <TextBlock FontFamily="../Resources/fonts/#iconfont" Foreground="Orange" Text="&#xe62b;" FontSize="24" VerticalAlignment="Center" Margin="0,0,8,0"/>
  446. <TextBlock Text="Account" />
  447. </StackPanel>
  448. </DataGridTemplateColumn.Header>
  449. <DataGridTemplateColumn.CellTemplate>
  450. <DataTemplate>
  451. <TextBox Text="{Binding Password}" Style="{StaticResource textboxStyle}"></TextBox>
  452. </DataTemplate>
  453. </DataGridTemplateColumn.CellTemplate>
  454. </DataGridTemplateColumn>-->
  455. <DataGridTextColumn FontSize="16" IsReadOnly="False" Width="0.2*" Binding="{Binding Password}" ElementStyle="{StaticResource dgCell}" >
  456. <DataGridTextColumn.Header>
  457. <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
  458. <TextBlock FontFamily="../Resources/fonts/#iconfont" Foreground="Orange" Text="&#xe62b;" VerticalAlignment="Center" Margin="0,0,8,0"/>
  459. <TextBlock Text="Password"/>
  460. </StackPanel>
  461. </DataGridTextColumn.Header>
  462. </DataGridTextColumn>
  463. <DataGridTextColumn FontSize="16" IsReadOnly="True" Width="0.2*" Binding="{Binding CardId}" ElementStyle="{StaticResource dgCell}">
  464. <DataGridTextColumn.Header>
  465. <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
  466. <TextBlock FontFamily="../Resources/fonts/#iconfont" Foreground="Orange" Text="&#xe8e0;" VerticalAlignment="Center" Margin="0,0,8,0"/>
  467. <TextBlock Text="NFC"/>
  468. </StackPanel>
  469. </DataGridTextColumn.Header>
  470. </DataGridTextColumn>
  471. <DataGridTemplateColumn Width="0.2*">
  472. <DataGridTemplateColumn.Header>
  473. <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
  474. <TextBlock FontFamily="../Resources/fonts/#iconfont" Foreground="Orange" Text="&#xe62c;" VerticalAlignment="Center" Margin="0,0,8,0"/>
  475. <TextBlock Text="Authority"/>
  476. </StackPanel>
  477. </DataGridTemplateColumn.Header>
  478. <DataGridTemplateColumn.CellTemplate>
  479. <DataTemplate>
  480. <ComboBox Style="{StaticResource ComboBoxStyle1}" Text="{Binding permission}" Tag="{Binding Id}" SelectedItem="{Binding permission}" SelectionChanged="ComboBox_SelectionChanged" ItemsSource="{Binding DataContext.Authorities, RelativeSource={RelativeSource AncestorType=DataGrid, Mode=FindAncestor}}" Foreground="SkyBlue" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" FontSize="16">
  481. <ComboBox.ItemContainerStyle>
  482. <Style TargetType="{x:Type ComboBoxItem}">
  483. <Setter Property="FontSize" Value="16"/>
  484. <Setter Property="Background" Value="White" />
  485. <Setter Property="Foreground" Value="#FF2AB2E7"/>
  486. </Style>
  487. </ComboBox.ItemContainerStyle>
  488. </ComboBox>
  489. </DataTemplate>
  490. </DataGridTemplateColumn.CellTemplate>
  491. </DataGridTemplateColumn>
  492. <DataGridTemplateColumn Width="0.4*">
  493. <DataGridTemplateColumn.Header>
  494. <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
  495. <TextBlock FontFamily="../Resources/fonts/#iconfont" Foreground="Orange" Text="&#xe979;" VerticalAlignment="Center" Margin="0,0,8,0"/>
  496. <TextBlock Text="Operate"/>
  497. </StackPanel>
  498. </DataGridTemplateColumn.Header>
  499. <DataGridTemplateColumn.CellTemplate>
  500. <DataTemplate>
  501. <Grid>
  502. <Grid.ColumnDefinitions>
  503. <ColumnDefinition/>
  504. <ColumnDefinition/>
  505. <!--<ColumnDefinition/>-->
  506. </Grid.ColumnDefinitions>
  507. <Button Command="{Binding DataContext.SaveCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}"
  508. CommandParameter="{Binding UserName}" Template="{DynamicResource ButtonTemplate1}" Style="{StaticResource btnStyle}" Foreground="Cyan" Content="Save" Margin="5,0"></Button>
  509. <!--<Button Command="{Binding DataContext.UpdateCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" Template="{DynamicResource ButtonTemplate1}" Style="{StaticResource btnStyle}" Content="Update" Grid.Column="1" Margin="5,0"></Button>-->
  510. <Button Command="{Binding DataContext.DeleteCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" CommandParameter="{Binding Id}" Template="{DynamicResource ButtonTemplate1}" Style="{StaticResource btnStyle}" Content="Delete" Grid.Column="1" Foreground="Cyan" Margin="5,0"></Button>
  511. </Grid>
  512. </DataTemplate>
  513. </DataGridTemplateColumn.CellTemplate>
  514. </DataGridTemplateColumn>
  515. </DataGrid.Columns>
  516. </DataGrid>
  517. </ScrollViewer>
  518. </Grid>
  519. </UserControl>