终端一体化运控平台
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.
 
 
 

788 line
54 KiB

  1. <Window x:Class="BPASmartClient.CustomResource.Pages.View.UserConfigView"
  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:BPASmartClient.CustomResource.Pages.View"
  7. xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
  8. Title="UserConfigView" Width="800"
  9. Height="1000"
  10. AllowsTransparency="True"
  11. Background="{x:Null}"
  12. Topmost="True"
  13. WindowStartupLocation="CenterScreen"
  14. WindowStyle="None"
  15. mc:Ignorable="d">
  16. <Window.DataContext>
  17. <vm:UserConfigViewModel/>
  18. </Window.DataContext>
  19. <Window.Resources>
  20. <ImageBrush x:Key="ImageBrushAddBlue" ImageSource="../../Image/按钮/AddGreen.png"></ImageBrush>
  21. <ImageBrush x:Key="ImageBrushAddGray" ImageSource="../../Image/按钮/Delete.png"></ImageBrush>
  22. <Style x:Key="ScrollBarPageButton" TargetType="{x:Type RepeatButton}">
  23. <Setter Property="SnapsToDevicePixels" Value="True" />
  24. <Setter Property="OverridesDefaultStyle" Value="true" />
  25. <Setter Property="IsTabStop" Value="false" />
  26. <Setter Property="Focusable" Value="false" />
  27. <Setter Property="Template">
  28. <Setter.Value>
  29. <ControlTemplate TargetType="{x:Type RepeatButton}">
  30. <Border Background="Transparent" />
  31. </ControlTemplate>
  32. </Setter.Value>
  33. </Setter>
  34. </Style>
  35. <Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}">
  36. <Setter Property="SnapsToDevicePixels" Value="True" />
  37. <Setter Property="OverridesDefaultStyle" Value="true" />
  38. <Setter Property="IsTabStop" Value="false" />
  39. <Setter Property="Focusable" Value="false" />
  40. <Setter Property="Template">
  41. <Setter.Value>
  42. <ControlTemplate TargetType="{x:Type Thumb}">
  43. <Border CornerRadius="2" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" />
  44. </ControlTemplate>
  45. </Setter.Value>
  46. </Setter>
  47. </Style>
  48. <ControlTemplate x:Key="VerticalScrollBar" TargetType="{x:Type ScrollBar}">
  49. <Grid>
  50. <Border CornerRadius="2" Width="0.5" Background="#FF046BFF" />
  51. <Track x:Name="PART_Track" IsDirectionReversed="true">
  52. <Track.DecreaseRepeatButton>
  53. <RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageUpCommand" />
  54. </Track.DecreaseRepeatButton>
  55. <Track.Thumb>
  56. <Thumb Style="{StaticResource ScrollBarThumb}" Margin="4,0,4,0" Background="DodgerBlue"></Thumb>
  57. </Track.Thumb>
  58. <Track.IncreaseRepeatButton>
  59. <RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageDownCommand" />
  60. </Track.IncreaseRepeatButton>
  61. </Track>
  62. </Grid>
  63. </ControlTemplate>
  64. <ControlTemplate x:Key="ScrollViewerControlTemplate1" TargetType="{x:Type ScrollViewer}">
  65. <Grid x:Name="Grid" Background="{TemplateBinding Background}">
  66. <Grid.ColumnDefinitions>
  67. <ColumnDefinition Width="*"/>
  68. <ColumnDefinition Width="Auto"/>
  69. </Grid.ColumnDefinitions>
  70. <Grid.RowDefinitions>
  71. <RowDefinition Height="*"/>
  72. <RowDefinition Height="Auto"/>
  73. </Grid.RowDefinitions>
  74. <Rectangle x:Name="Corner" Grid.Column="1" Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Grid.Row="1"/>
  75. <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="0"/>
  76. <ScrollBar x:Name="PART_VerticalScrollBar" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1"
  77. Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
  78. Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}"
  79. Template="{StaticResource VerticalScrollBar}"/>
  80. <ScrollBar x:Name="PART_HorizontalScrollBar" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/>
  81. </Grid>
  82. </ControlTemplate>
  83. <!--对象树子模板-->
  84. <DataTemplate x:Key="TreeItemTemplate" DataType="TreeViewItem">
  85. <Grid Margin="50,0,0,0" Height="28">
  86. <Grid.ColumnDefinitions>
  87. <ColumnDefinition Width="*"></ColumnDefinition>
  88. <ColumnDefinition Width="30"></ColumnDefinition>
  89. </Grid.ColumnDefinitions>
  90. <TextBlock x:Name="tb_PageName" Text="{Binding Name}" Foreground="White" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0"/>
  91. <Button x:Name="BtnAdd" Grid.Column="1" Background="Transparent" VerticalAlignment="Center" HorizontalAlignment="Center"
  92. Command="{Binding DataContext.AddUserPageCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=TreeView}}"
  93. CommandParameter="{Binding Path=Text,ElementName=tb_PageName}">
  94. <Button.Template>
  95. <ControlTemplate TargetType="Button">
  96. <Grid>
  97. <Rectangle x:Name="BtnRetangle" Height="20" Width="20" Stroke="Transparent" StrokeThickness="1"
  98. Fill="{StaticResource ImageBrushAddBlue}"
  99. VerticalAlignment="Center" HorizontalAlignment="Center">
  100. </Rectangle>
  101. <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter>
  102. </Grid>
  103. <ControlTemplate.Triggers>
  104. <Trigger Property="IsMouseOver" Value="True">
  105. <Setter TargetName="BtnRetangle" Property="Height" Value="22"></Setter>
  106. <Setter TargetName="BtnRetangle" Property="Width" Value="22"></Setter>
  107. </Trigger>
  108. <DataTrigger Binding="{Binding IsChecked}" Value="true">
  109. <Setter TargetName="BtnRetangle" Property="Fill" Value="{StaticResource ImageBrushAddGray}"></Setter>
  110. <Setter Property="ToolTip" Value="已添加"></Setter>
  111. </DataTrigger>
  112. <DataTrigger Binding="{Binding IsChecked}" Value="false">
  113. <Setter TargetName="BtnRetangle" Property="Fill" Value="{StaticResource ImageBrushAddBlue}"></Setter>
  114. <Setter Property="ToolTip" Value="添加"></Setter>
  115. </DataTrigger>
  116. </ControlTemplate.Triggers>
  117. </ControlTemplate>
  118. </Button.Template>
  119. </Button>
  120. </Grid>
  121. </DataTemplate>
  122. <Style TargetType="TreeViewItem">
  123. <Setter Property="Background" Value="Transparent" />
  124. <Setter Property="IsExpanded" Value="True"></Setter>
  125. <Setter Property="HeaderTemplate">
  126. <Setter.Value>
  127. <HierarchicalDataTemplate ItemsSource="{Binding TreeViewItems,Mode=TwoWay}" ItemTemplate="{StaticResource TreeItemTemplate}">
  128. <StackPanel Orientation="Horizontal" Height="28" VerticalAlignment="Center" HorizontalAlignment="Left">
  129. <!--Image Source="folder.png" VerticalAlignment="Center" Height="17" Margin="10,0"/>-->
  130. <TextBlock Text="{Binding Name}" Margin="5,0,0,0" FontSize="15" VerticalAlignment="Center" Foreground="White"/>
  131. </StackPanel>
  132. </HierarchicalDataTemplate>
  133. </Setter.Value>
  134. </Setter>
  135. <Setter Property="Template">
  136. <Setter.Value>
  137. <ControlTemplate TargetType="{x:Type TreeViewItem}">
  138. <Grid>
  139. <Grid.ColumnDefinitions>
  140. <ColumnDefinition Width="Auto" />
  141. <ColumnDefinition Width="*" />
  142. </Grid.ColumnDefinitions>
  143. <Grid.RowDefinitions>
  144. <RowDefinition Height="Auto" />
  145. <RowDefinition />
  146. </Grid.RowDefinitions>
  147. <VisualStateManager.VisualStateGroups>
  148. <VisualStateGroup x:Name="SelectionStates">
  149. <VisualState x:Name="Selected">
  150. <Storyboard>
  151. <ColorAnimationUsingKeyFrames Storyboard.TargetName="Bd" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" >
  152. <EasingColorKeyFrame KeyTime="0" Value="Transparent" />
  153. </ColorAnimationUsingKeyFrames>
  154. </Storyboard>
  155. </VisualState>
  156. <VisualState x:Name="Unselected" />
  157. <VisualState x:Name="SelectedInactive">
  158. <Storyboard>
  159. <ColorAnimationUsingKeyFrames Storyboard.TargetName="Bd" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)">
  160. <EasingColorKeyFrame KeyTime="0" Value="Transparent" />
  161. </ColorAnimationUsingKeyFrames>
  162. </Storyboard>
  163. </VisualState>
  164. </VisualStateGroup>
  165. <VisualStateGroup x:Name="ExpansionStates">
  166. <VisualState x:Name="Expanded">
  167. <Storyboard>
  168. <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="ItemsHost">
  169. <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
  170. </ObjectAnimationUsingKeyFrames>
  171. </Storyboard>
  172. </VisualState>
  173. <VisualState x:Name="Collapsed" />
  174. </VisualStateGroup>
  175. </VisualStateManager.VisualStateGroups>
  176. <Border x:Name="Bd" Grid.Column="0" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
  177. <ContentPresenter x:Name="PART_Header" ContentSource="Header" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/>
  178. </Border>
  179. <ItemsPresenter x:Name="ItemsHost" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Visibility="Collapsed" />
  180. </Grid>
  181. <ControlTemplate.Triggers>
  182. <MultiTrigger>
  183. <MultiTrigger.Conditions>
  184. <Condition Property="HasHeader" Value="false" />
  185. <Condition Property="Width" Value="Auto" />
  186. </MultiTrigger.Conditions>
  187. <Setter TargetName="PART_Header" Property="MinWidth" Value="75" />
  188. </MultiTrigger>
  189. <MultiTrigger>
  190. <MultiTrigger.Conditions>
  191. <Condition Property="HasHeader" Value="false" />
  192. <Condition Property="Height" Value="Auto" />
  193. </MultiTrigger.Conditions>
  194. <Setter TargetName="PART_Header" Property="MinHeight" Value="19" />
  195. </MultiTrigger>
  196. </ControlTemplate.Triggers>
  197. </ControlTemplate>
  198. </Setter.Value>
  199. </Setter>
  200. </Style>
  201. <Style x:Key="ItemContainer" TargetType="{x:Type ListBoxItem}">
  202. <Setter Property="Template">
  203. <Setter.Value>
  204. <ControlTemplate TargetType="{x:Type ListBoxItem}">
  205. <Border x:Name="IconBorder" Background="Transparent" CornerRadius="4" BorderThickness="0">
  206. <ContentPresenter />
  207. </Border>
  208. <ControlTemplate.Triggers>
  209. <Trigger Property="IsSelected" Value="true">
  210. <Setter TargetName="IconBorder" Property="BitmapEffect">
  211. <Setter.Value>
  212. <OuterGlowBitmapEffect GlowColor="Transparent" GlowSize="5" />
  213. </Setter.Value>
  214. </Setter>
  215. </Trigger>
  216. </ControlTemplate.Triggers>
  217. </ControlTemplate>
  218. </Setter.Value>
  219. </Setter>
  220. </Style>
  221. <!--切换button-->
  222. <Style x:Key="changebutton_local" TargetType="Button">
  223. <Setter Property="Height" Value="32"/>
  224. <Setter Property="Width" Value="130"/>
  225. <Setter Property="FontSize" Value="18"/>
  226. <Setter Property="Foreground" Value="White"/>
  227. <Setter Property="Template">
  228. <Setter.Value>
  229. <ControlTemplate TargetType="Button" >
  230. <Border x:Name="border" BorderThickness="0" BorderBrush="White" SnapsToDevicePixels="True">
  231. <Border.Background>
  232. <DrawingBrush>
  233. <DrawingBrush.Drawing>
  234. <GeometryDrawing Brush="#009DFF">
  235. <GeometryDrawing.Pen>
  236. <Pen x:Name="pen" Thickness="3" Brush="{TemplateBinding BorderBrush }" ></Pen>
  237. </GeometryDrawing.Pen>
  238. <GeometryDrawing.Geometry >
  239. <PathGeometry Figures="m-70 -80 L200 -80 L200 80 L70 80 L-70 80 A 10,10 0 0 1 -80,70 L-80 70 L-80 -70 A 10,10 0 0 1 -70,-80"></PathGeometry>
  240. </GeometryDrawing.Geometry>
  241. </GeometryDrawing>
  242. </DrawingBrush.Drawing>
  243. </DrawingBrush>
  244. </Border.Background>
  245. <TextBlock Text="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" VerticalAlignment="Top" HorizontalAlignment="Center" Margin="0,5,0,0" />
  246. </Border>
  247. <ControlTemplate.Triggers>
  248. <Trigger Property="IsMouseOver" Value="True">
  249. </Trigger>
  250. <DataTrigger Binding="{Binding IsChecked}" Value="true">
  251. <Setter Property="Height" Value="43"/>
  252. <Setter Property="Width" Value="133"/>
  253. <Setter Property="Effect">
  254. <Setter.Value>
  255. <DropShadowEffect Color="Black" Direction="220" ShadowDepth="15" Opacity="1"/>
  256. </Setter.Value>
  257. </Setter>
  258. <Setter TargetName="border" Property="Background" >
  259. <Setter.Value>
  260. <DrawingBrush>
  261. <DrawingBrush.Drawing>
  262. <GeometryDrawing Brush="#009DFF">
  263. <GeometryDrawing.Pen>
  264. <Pen Thickness="5" Brush="White" ></Pen>
  265. </GeometryDrawing.Pen>
  266. <GeometryDrawing.Geometry >
  267. <PathGeometry Figures="m-70 -80 L200 -80 L200 80 L200 80 L50 80 L60 130 L70 80 L-70 80 A 10,10 0 0 1 -80,70 L-80 70 L-80 -70 A 10,10 0 0 1 -70,-80"></PathGeometry>
  268. </GeometryDrawing.Geometry>
  269. </GeometryDrawing>
  270. </DrawingBrush.Drawing>
  271. </DrawingBrush>
  272. </Setter.Value>
  273. </Setter>
  274. </DataTrigger>
  275. </ControlTemplate.Triggers>
  276. </ControlTemplate>
  277. </Setter.Value>
  278. </Setter>
  279. <Style.Triggers>
  280. </Style.Triggers>
  281. </Style>
  282. <Style x:Key="changebutton_device" TargetType="Button">
  283. <Setter Property="Height" Value="32"/>
  284. <Setter Property="Width" Value="130"/>
  285. <Setter Property="FontSize" Value="18"/>
  286. <Setter Property="Foreground" Value="White"/>
  287. <Setter Property="Template">
  288. <Setter.Value>
  289. <ControlTemplate TargetType="Button" >
  290. <Border x:Name="border" BorderThickness="0" BorderBrush="White" SnapsToDevicePixels="True">
  291. <Border.Background>
  292. <DrawingBrush>
  293. <DrawingBrush.Drawing>
  294. <GeometryDrawing Brush="#009DFF">
  295. <GeometryDrawing.Pen>
  296. <Pen x:Name="pen" Thickness="3" Brush="{TemplateBinding BorderBrush }" ></Pen>
  297. </GeometryDrawing.Pen>
  298. <GeometryDrawing.Geometry >
  299. <PathGeometry Figures="m-70 -80 L200 -80 L200 80 L70 80 L-70 80 A 10,10 0 0 1 -80,70 L-80 70 L-80 -70 A 10,10 0 0 1 -70,-80"></PathGeometry>
  300. </GeometryDrawing.Geometry>
  301. </GeometryDrawing>
  302. </DrawingBrush.Drawing>
  303. </DrawingBrush>
  304. </Border.Background>
  305. <TextBlock Text="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" VerticalAlignment="Top" HorizontalAlignment="Center" Margin="0,5,0,0" />
  306. </Border>
  307. <ControlTemplate.Triggers>
  308. <Trigger Property="IsMouseOver" Value="True">
  309. </Trigger>
  310. <DataTrigger Binding="{Binding IsChecked}" Value="false">
  311. <Setter Property="Height" Value="43"/>
  312. <Setter Property="Width" Value="133"/>
  313. <Setter Property="Effect">
  314. <Setter.Value>
  315. <DropShadowEffect Color="Black" Direction="220" ShadowDepth="15" Opacity="1"/>
  316. </Setter.Value>
  317. </Setter>
  318. <Setter TargetName="border" Property="Background" >
  319. <Setter.Value>
  320. <DrawingBrush>
  321. <DrawingBrush.Drawing>
  322. <GeometryDrawing Brush="#009DFF">
  323. <GeometryDrawing.Pen>
  324. <Pen Thickness="5" Brush="White" ></Pen>
  325. </GeometryDrawing.Pen>
  326. <GeometryDrawing.Geometry >
  327. <PathGeometry Figures="m-70 -80 L200 -80 L200 80 L200 80 L50 80 L60 130 L70 80 L-70 80 A 10,10 0 0 1 -80,70 L-80 70 L-80 -70 A 10,10 0 0 1 -70,-80"></PathGeometry>
  328. </GeometryDrawing.Geometry>
  329. </GeometryDrawing>
  330. </DrawingBrush.Drawing>
  331. </DrawingBrush>
  332. </Setter.Value>
  333. </Setter>
  334. </DataTrigger>
  335. </ControlTemplate.Triggers>
  336. </ControlTemplate>
  337. </Setter.Value>
  338. </Setter>
  339. </Style>
  340. </Window.Resources>
  341. <Border Background="Black"
  342. x:Name="br"
  343. BorderBrush="#009dff"
  344. BorderThickness="2">
  345. <Border.Effect>
  346. <DropShadowEffect
  347. BlurRadius="10"
  348. ShadowDepth="1"
  349. Color="#009DFF" />
  350. </Border.Effect>
  351. <Grid>
  352. <Image Source="../../Image/权限背景.png" Stretch="Fill"/>
  353. <Grid Background="Transparent">
  354. <Grid.RowDefinitions>
  355. <RowDefinition Height="60"/>
  356. <RowDefinition Height="40"/>
  357. <RowDefinition Height="10*"/>
  358. <RowDefinition Height="40"/>
  359. <RowDefinition Height="13*"/>
  360. <RowDefinition Height="50"/>
  361. <RowDefinition Height="5"/>
  362. </Grid.RowDefinitions>
  363. <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
  364. <TextBlock Text="{Binding UserName}" HorizontalAlignment="Center"
  365. FontSize="24"
  366. Foreground="#ddd"/>
  367. <TextBlock Text="权限分配" Margin="10,0,0,0"
  368. HorizontalAlignment="Center"
  369. FontSize="24"
  370. Foreground="#ddd"/>
  371. </StackPanel>
  372. <TextBlock Grid.Row="1"
  373. Text="页面权限分配" Margin="10,0,0,0"
  374. HorizontalAlignment="Center" VerticalAlignment="Top"
  375. FontSize="20"
  376. Foreground="#ddd"/>
  377. <TextBlock Grid.Row="3"
  378. Text="配料权限分配" Margin="10,0,0,0"
  379. HorizontalAlignment="Center" VerticalAlignment="Center"
  380. FontSize="20"
  381. Foreground="#ddd"/>
  382. <Grid Grid.Row="2">
  383. <Grid.ColumnDefinitions>
  384. <ColumnDefinition Width="50"/>
  385. <ColumnDefinition Width="*"/>
  386. <ColumnDefinition Width="100"/>
  387. <ColumnDefinition Width="*"/>
  388. <ColumnDefinition Width="50"/>
  389. </Grid.ColumnDefinitions>
  390. <TextBlock Text="权限列表" Width="20"
  391. TextWrapping="Wrap" Grid.Column="0"
  392. HorizontalAlignment="Center" VerticalAlignment="Center"
  393. FontSize="20"
  394. Foreground="#ddd"/>
  395. <TextBlock Text="当前用户权限" Width="20"
  396. Grid.Column="4"
  397. TextWrapping="Wrap"
  398. HorizontalAlignment="Center" VerticalAlignment="Center"
  399. FontSize="20"
  400. Foreground="#ddd"/>
  401. <!--#region 页面权限-->
  402. <Border Grid.Column="1" BorderBrush="#1874CD" BorderThickness="1" />
  403. <Border Grid.Column="3" BorderBrush="#1874CD" BorderThickness="1" />
  404. <ScrollViewer Grid.Column="1" Margin="20,5,5,5" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True" >
  405. <TreeView x:Name="MyTreeView" ItemsSource="{Binding pageTreeViewModels}"
  406. ScrollViewer.VerticalScrollBarVisibility="Disabled" HorizontalAlignment="Stretch" Background="Transparent" BorderBrush="Transparent"></TreeView>
  407. </ScrollViewer>
  408. <ScrollViewer Grid.Column="3" Margin="10,0,10,0" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True">
  409. <ListBox x:Name="RightListBox" Grid.Column="3" Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}"
  410. ItemsSource="{Binding SelectePage}" >
  411. <ListBox.Template>
  412. <ControlTemplate>
  413. <StackPanel Background="Transparent" IsItemsHost="True"></StackPanel>
  414. </ControlTemplate>
  415. </ListBox.Template>
  416. <ListBox.ItemTemplate>
  417. <DataTemplate>
  418. <Grid Height="28" Margin="10">
  419. <Grid.ColumnDefinitions>
  420. <ColumnDefinition Width="*"></ColumnDefinition>
  421. <ColumnDefinition Width="60"></ColumnDefinition>
  422. </Grid.ColumnDefinitions>
  423. <TextBlock x:Name="tb_Name" Text="{Binding Name}" Foreground="White" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Left" />
  424. <Button x:Name="BtnDelete" Grid.Column="1" Background="Transparent" ToolTip="移除" VerticalAlignment="Center" HorizontalAlignment="Left"
  425. Command="{Binding DataContext.DeleteUserPageCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"
  426. CommandParameter="{Binding Path=Text,ElementName=tb_Name}">
  427. <Button.Template>
  428. <ControlTemplate TargetType="Button">
  429. <Grid>
  430. <Rectangle x:Name="BtnRetangle" Height="17" Width="17" Stroke="Transparent" StrokeThickness="1" VerticalAlignment="Center" HorizontalAlignment="Left">
  431. <Rectangle.Fill>
  432. <ImageBrush ImageSource="../../Image/按钮/Delete.png"></ImageBrush>
  433. </Rectangle.Fill>
  434. </Rectangle>
  435. <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter>
  436. </Grid>
  437. <ControlTemplate.Triggers>
  438. <Trigger Property="IsMouseOver" Value="True">
  439. <Setter TargetName="BtnRetangle" Property="Height" Value="19"></Setter>
  440. <Setter TargetName="BtnRetangle" Property="Width" Value="19"></Setter>
  441. </Trigger>
  442. </ControlTemplate.Triggers>
  443. </ControlTemplate>
  444. </Button.Template>
  445. </Button>
  446. </Grid>
  447. </DataTemplate>
  448. </ListBox.ItemTemplate>
  449. </ListBox>
  450. </ScrollViewer>
  451. <StackPanel Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center">
  452. <Button Foreground="White" Background="#009DFF"
  453. FontSize="16" Height="50" Width="70" Margin="10,20"
  454. Command="{Binding AddAllCommand}" CommandParameter="page">
  455. <TextBlock Text="全部
  456. 添加" TextWrapping="Wrap"/>
  457. </Button>
  458. <Button Foreground="White" Background="#009DFF"
  459. FontSize="16" Height="50" Width="70" Margin="10,20"
  460. Command="{Binding DeleteAllCommand}" CommandParameter="page">
  461. <TextBlock Text="全部
  462. 移除" TextWrapping="Wrap"/>
  463. </Button>
  464. </StackPanel>
  465. <!--#endregion-->
  466. </Grid>
  467. <Grid Grid.Row="4">
  468. <Grid.ColumnDefinitions>
  469. <ColumnDefinition Width="50"/>
  470. <ColumnDefinition Width="*"/>
  471. <ColumnDefinition Width="100"/>
  472. <ColumnDefinition Width="*"/>
  473. <ColumnDefinition Width="50"/>
  474. </Grid.ColumnDefinitions>
  475. <Grid.RowDefinitions>
  476. <RowDefinition Height="60"/>
  477. <RowDefinition Height="*"/>
  478. </Grid.RowDefinitions>
  479. <TextBlock Text="权限列表" Width="20"
  480. Grid.Row="1"
  481. TextWrapping="Wrap"
  482. HorizontalAlignment="Center" VerticalAlignment="Center"
  483. FontSize="20"
  484. Foreground="#ddd"/>
  485. <TextBlock Text="当前用户权限" Width="20"
  486. Grid.Row="1"
  487. Grid.Column="4"
  488. TextWrapping="Wrap"
  489. HorizontalAlignment="Center" VerticalAlignment="Center"
  490. FontSize="20"
  491. Foreground="#ddd"/>
  492. <Button Content="本地原料" Grid.Column="1" Style="{DynamicResource changebutton_local}" HorizontalAlignment="Right"
  493. Command="{Binding ChangeMaterailPageCommand}" CommandParameter="Local"/>
  494. <Button Content="设备原料" Grid.Column="3" Style="{DynamicResource changebutton_device}" HorizontalAlignment="Left"
  495. Command="{Binding ChangeMaterailPageCommand}" CommandParameter="Device"/>
  496. <!--#region 本地原料权限-->
  497. <Border Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" BorderBrush="#1874CD" BorderThickness="1"
  498. Visibility="{Binding VisibilityLocal}">
  499. <Grid Margin="5">
  500. <Grid.ColumnDefinitions>
  501. <ColumnDefinition Width="*"/>
  502. <ColumnDefinition Width="100"/>
  503. <ColumnDefinition Width="*"/>
  504. </Grid.ColumnDefinitions>
  505. <Border Grid.Column="0" BorderBrush="#1874CD" BorderThickness="1" />
  506. <Border Grid.Column="2" BorderBrush="#1874CD" BorderThickness="1" />
  507. <ScrollViewer Width="230" Margin="20,5,5,5" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True" HorizontalAlignment="Right" >
  508. <ListBox Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}"
  509. ItemsSource="{Binding LoaclMaterails}" >
  510. <ListBox.Template>
  511. <ControlTemplate>
  512. <StackPanel Background="Transparent" IsItemsHost="True"></StackPanel>
  513. </ControlTemplate>
  514. </ListBox.Template>
  515. <ListBox.ItemTemplate>
  516. <DataTemplate>
  517. <Grid Height="28" Margin="5">
  518. <Grid.ColumnDefinitions>
  519. <ColumnDefinition Width="*"></ColumnDefinition>
  520. <ColumnDefinition Width="60"></ColumnDefinition>
  521. </Grid.ColumnDefinitions>
  522. <TextBlock x:Name="tb_Name" Text="{Binding RawMaterialName}" Foreground="White" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Left" />
  523. <Button x:Name="BtnDelete" Grid.Column="1" Background="Transparent" ToolTip="移除" VerticalAlignment="Center" HorizontalAlignment="Left"
  524. Command="{Binding DataContext.AddLoaclMaterialCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"
  525. CommandParameter="{Binding Path=Text,ElementName=tb_Name}">
  526. <Button.Template>
  527. <ControlTemplate TargetType="Button">
  528. <Grid>
  529. <Rectangle x:Name="BtnRetangle" Height="17" Width="17" Stroke="Transparent" StrokeThickness="1" VerticalAlignment="Center" HorizontalAlignment="Left">
  530. <Rectangle.Fill>
  531. <ImageBrush ImageSource="../../Image/按钮/AddGreen.png"></ImageBrush>
  532. </Rectangle.Fill>
  533. </Rectangle>
  534. <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter>
  535. </Grid>
  536. <ControlTemplate.Triggers>
  537. <Trigger Property="IsMouseOver" Value="True">
  538. <Setter TargetName="BtnRetangle" Property="Height" Value="19"></Setter>
  539. <Setter TargetName="BtnRetangle" Property="Width" Value="19"></Setter>
  540. </Trigger>
  541. </ControlTemplate.Triggers>
  542. </ControlTemplate>
  543. </Button.Template>
  544. </Button>
  545. </Grid>
  546. </DataTemplate>
  547. </ListBox.ItemTemplate>
  548. </ListBox>
  549. </ScrollViewer>
  550. <ScrollViewer Grid.Column="2" Margin="10,0,10,0" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True">
  551. <ListBox Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}"
  552. Width="230"
  553. ItemsSource="{Binding UserLoaclMaterails}" >
  554. <ListBox.Template>
  555. <ControlTemplate>
  556. <StackPanel Background="Transparent" IsItemsHost="True"></StackPanel>
  557. </ControlTemplate>
  558. </ListBox.Template>
  559. <ListBox.ItemTemplate>
  560. <DataTemplate>
  561. <Grid Height="28" Margin="5">
  562. <Grid.ColumnDefinitions>
  563. <ColumnDefinition Width="*"></ColumnDefinition>
  564. <ColumnDefinition Width="60"></ColumnDefinition>
  565. </Grid.ColumnDefinitions>
  566. <TextBlock x:Name="tb_Name" Text="{Binding RawMaterialName}" Foreground="White" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Left" />
  567. <Button x:Name="BtnDelete" Grid.Column="1" Background="Transparent" ToolTip="移除" VerticalAlignment="Center" HorizontalAlignment="Left"
  568. Command="{Binding DataContext.DeleteLoaclMaterialCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"
  569. CommandParameter="{Binding Path=Text,ElementName=tb_Name}">
  570. <Button.Template>
  571. <ControlTemplate TargetType="Button">
  572. <Grid>
  573. <Rectangle x:Name="BtnRetangle" Height="17" Width="17" Stroke="Transparent" StrokeThickness="1" VerticalAlignment="Center" HorizontalAlignment="Left">
  574. <Rectangle.Fill>
  575. <ImageBrush ImageSource="../../Image/按钮/Delete.png"></ImageBrush>
  576. </Rectangle.Fill>
  577. </Rectangle>
  578. <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter>
  579. </Grid>
  580. <ControlTemplate.Triggers>
  581. <Trigger Property="IsMouseOver" Value="True">
  582. <Setter TargetName="BtnRetangle" Property="Height" Value="19"></Setter>
  583. <Setter TargetName="BtnRetangle" Property="Width" Value="19"></Setter>
  584. </Trigger>
  585. </ControlTemplate.Triggers>
  586. </ControlTemplate>
  587. </Button.Template>
  588. </Button>
  589. </Grid>
  590. </DataTemplate>
  591. </ListBox.ItemTemplate>
  592. </ListBox>
  593. </ScrollViewer>
  594. <StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
  595. <Button Foreground="White" Background="#009DFF"
  596. FontSize="16" Height="50" Width="70" Margin="10,20"
  597. Command="{Binding AddAllCommand}" CommandParameter="local">
  598. <TextBlock Text="全部
  599. 添加" TextWrapping="Wrap"/>
  600. </Button>
  601. <Button Foreground="White" Background="#009DFF"
  602. FontSize="16" Height="50" Width="70" Margin="10,20"
  603. Command="{Binding DeleteAllCommand}" CommandParameter="local">
  604. <TextBlock Text="全部
  605. 移除" TextWrapping="Wrap"/>
  606. </Button>
  607. </StackPanel>
  608. </Grid>
  609. </Border>
  610. <!--#endregion-->
  611. <!--#region 设备原料权限-->
  612. <Border Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" BorderBrush="#1874CD" BorderThickness="1"
  613. Visibility="{Binding VisibilityDevice}">
  614. <Grid Margin="5">
  615. <Grid.ColumnDefinitions>
  616. <ColumnDefinition Width="*"/>
  617. <ColumnDefinition Width="100"/>
  618. <ColumnDefinition Width="*"/>
  619. </Grid.ColumnDefinitions>
  620. <Border Grid.Column="0" BorderBrush="#1874CD" BorderThickness="1" />
  621. <Border Grid.Column="2" BorderBrush="#1874CD" BorderThickness="1" />
  622. <ScrollViewer Width="230" Margin="20,5,5,5" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True" HorizontalAlignment="Right" >
  623. <ListBox Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}"
  624. ItemsSource="{Binding DeviceMaterails}" >
  625. <ListBox.Template>
  626. <ControlTemplate>
  627. <StackPanel Background="Transparent" IsItemsHost="True"></StackPanel>
  628. </ControlTemplate>
  629. </ListBox.Template>
  630. <ListBox.ItemTemplate>
  631. <DataTemplate>
  632. <Grid Height="28" Margin="5">
  633. <Grid.ColumnDefinitions>
  634. <ColumnDefinition Width="*"></ColumnDefinition>
  635. <ColumnDefinition Width="60"></ColumnDefinition>
  636. </Grid.ColumnDefinitions>
  637. <TextBlock x:Name="tb_Name" Text="{Binding RawMaterialName}" Foreground="White" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Left" />
  638. <Button x:Name="BtnDelete" Grid.Column="1" Background="Transparent" ToolTip="移除" VerticalAlignment="Center" HorizontalAlignment="Left"
  639. Command="{Binding DataContext.AddDeviceMaterialCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"
  640. CommandParameter="{Binding Path=Text,ElementName=tb_Name}">
  641. <Button.Template>
  642. <ControlTemplate TargetType="Button">
  643. <Grid>
  644. <Rectangle x:Name="BtnRetangle" Height="17" Width="17" Stroke="Transparent" StrokeThickness="1" VerticalAlignment="Center" HorizontalAlignment="Left">
  645. <Rectangle.Fill>
  646. <ImageBrush ImageSource="../../Image/按钮/AddGreen.png"></ImageBrush>
  647. </Rectangle.Fill>
  648. </Rectangle>
  649. <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter>
  650. </Grid>
  651. <ControlTemplate.Triggers>
  652. <Trigger Property="IsMouseOver" Value="True">
  653. <Setter TargetName="BtnRetangle" Property="Height" Value="19"></Setter>
  654. <Setter TargetName="BtnRetangle" Property="Width" Value="19"></Setter>
  655. </Trigger>
  656. </ControlTemplate.Triggers>
  657. </ControlTemplate>
  658. </Button.Template>
  659. </Button>
  660. </Grid>
  661. </DataTemplate>
  662. </ListBox.ItemTemplate>
  663. </ListBox>
  664. </ScrollViewer>
  665. <ScrollViewer Grid.Column="2" Margin="10,0,10,0" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True">
  666. <ListBox Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}"
  667. Width="230"
  668. ItemsSource="{Binding UserDeviceMaterails}" >
  669. <ListBox.Template>
  670. <ControlTemplate>
  671. <StackPanel Background="Transparent" IsItemsHost="True"></StackPanel>
  672. </ControlTemplate>
  673. </ListBox.Template>
  674. <ListBox.ItemTemplate>
  675. <DataTemplate>
  676. <Grid Height="28" Margin="5">
  677. <Grid.ColumnDefinitions>
  678. <ColumnDefinition Width="*"></ColumnDefinition>
  679. <ColumnDefinition Width="60"></ColumnDefinition>
  680. </Grid.ColumnDefinitions>
  681. <TextBlock x:Name="tb_Name" Text="{Binding RawMaterialName}" Foreground="White" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Left" />
  682. <Button x:Name="BtnDelete" Grid.Column="1" Background="Transparent" ToolTip="移除" VerticalAlignment="Center" HorizontalAlignment="Left"
  683. Command="{Binding DataContext.DeleteDeviceMaterialCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"
  684. CommandParameter="{Binding Path=Text,ElementName=tb_Name}">
  685. <Button.Template>
  686. <ControlTemplate TargetType="Button">
  687. <Grid>
  688. <Rectangle x:Name="BtnRetangle" Height="17" Width="17" Stroke="Transparent" StrokeThickness="1" VerticalAlignment="Center" HorizontalAlignment="Left">
  689. <Rectangle.Fill>
  690. <ImageBrush ImageSource="../../Image/按钮/Delete.png"></ImageBrush>
  691. </Rectangle.Fill>
  692. </Rectangle>
  693. <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter>
  694. </Grid>
  695. <ControlTemplate.Triggers>
  696. <Trigger Property="IsMouseOver" Value="True">
  697. <Setter TargetName="BtnRetangle" Property="Height" Value="19"></Setter>
  698. <Setter TargetName="BtnRetangle" Property="Width" Value="19"></Setter>
  699. </Trigger>
  700. </ControlTemplate.Triggers>
  701. </ControlTemplate>
  702. </Button.Template>
  703. </Button>
  704. </Grid>
  705. </DataTemplate>
  706. </ListBox.ItemTemplate>
  707. </ListBox>
  708. </ScrollViewer>
  709. <StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
  710. <Button Foreground="White" Background="#009DFF"
  711. FontSize="16" Height="50" Width="70" Margin="10,20"
  712. Command="{Binding AddAllCommand}" CommandParameter="device">
  713. <TextBlock Text="全部
  714. 添加" TextWrapping="Wrap"/>
  715. </Button>
  716. <Button Foreground="White" Background="#009DFF"
  717. FontSize="16" Height="50" Width="70" Margin="10,20"
  718. Command="{Binding DeleteAllCommand}" CommandParameter="device">
  719. <TextBlock Text="全部
  720. 移除" TextWrapping="Wrap"/>
  721. </Button>
  722. </StackPanel>
  723. </Grid>
  724. </Border>
  725. <!--#endregion-->
  726. </Grid>
  727. <Grid Grid.Row="5">
  728. <Grid.ColumnDefinitions>
  729. <ColumnDefinition Width="*"/>
  730. <ColumnDefinition Width="*"/>
  731. </Grid.ColumnDefinitions>
  732. <Button Content="保存"
  733. Background="#009DFF"
  734. Margin="200,10,20,0"
  735. BorderThickness="0"
  736. Command="{Binding SaveCommand}"
  737. FontSize="20"
  738. Foreground="White"
  739. TabIndex="3" />
  740. <Button Content="取消" Grid.Column="1" Background="#009DFF"
  741. Margin="20,10,200,0"
  742. BorderThickness="0"
  743. Command="{Binding CancelCommand}"
  744. FontSize="20"
  745. Foreground="White"
  746. TabIndex="3"/>
  747. </Grid>
  748. </Grid>
  749. </Grid>
  750. </Border>
  751. </Window>