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

171 lines
9.4 KiB

  1. <UserControl x:Class="BPASmartClient.CustomResource.Pages.View.UserManagerView"
  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. Width="1400"
  9. Height="900"
  10. Background="{x:Null}"
  11. mc:Ignorable="d">
  12. <UserControl.DataContext>
  13. <vm:UserManagerViewModel/>
  14. </UserControl.DataContext>
  15. <UserControl.Resources>
  16. <Style x:Key="CommonTextBlockStyle" TargetType="TextBlock">
  17. <Setter Property="Background" Value="Transparent"/>
  18. <Setter Property="Foreground" Value="#B1E8FF"/>
  19. <Setter Property="HorizontalAlignment" Value="Center"/>
  20. <Setter Property="VerticalAlignment" Value="Center"/>
  21. </Style>
  22. <Style TargetType="{x:Type DataGridCell}">
  23. <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
  24. <Setter Property="TextBlock.FontSize" Value="13" />
  25. <Setter Property="Background" Value="Transparent"/>
  26. <Setter Property="BorderBrush" Value="#87CEFA"/>
  27. <Setter Property="BorderThickness" Value="1"/>
  28. <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Mode=Self},Path=Content.Text}" />
  29. <Setter Property="Template">
  30. <Setter.Value>
  31. <ControlTemplate TargetType="{x:Type DataGridCell}">
  32. <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
  33. <!--HorizontalAlignment 可以设置内容展示位置-->
  34. <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" HorizontalAlignment="Center"
  35. Margin="{TemplateBinding Padding}"/>
  36. </Border>
  37. </ControlTemplate>
  38. </Setter.Value>
  39. </Setter>
  40. <Style.Triggers>
  41. <Trigger Property="IsEnabled" Value="False">
  42. <Setter Property="Opacity" Value=".56"/>
  43. </Trigger>
  44. </Style.Triggers>
  45. </Style>
  46. <Style TargetType="DataGridRow">
  47. <Setter Property="FontSize" Value="16"/>
  48. <Setter Property="VerticalAlignment" Value="Center"/>
  49. <Setter Property="Margin" Value="0,5"/>
  50. <Style.Triggers>
  51. <!-- 隔行换色 -->
  52. <Trigger Property="AlternationIndex" Value="0">
  53. <Setter Property="Background" Value="Transparent" />
  54. </Trigger>
  55. <Trigger Property="AlternationIndex" Value="1">
  56. <Setter Property="Background" Value="Transparent" />
  57. </Trigger>
  58. <Trigger Property="IsMouseOver" Value="True">
  59. <Setter Property="Background" Value="#87CEFA" />
  60. </Trigger>
  61. </Style.Triggers>
  62. </Style>
  63. <Style TargetType="DataGridColumnHeader">
  64. <Setter Property="SnapsToDevicePixels" Value="True" />
  65. <Setter Property="MinWidth" Value="0" />
  66. <Setter Property="MinHeight" Value="40" />
  67. <Setter Property="Foreground" Value="#ddd" />
  68. <Setter Property="FontSize" Value="26" />
  69. <Setter Property="Cursor" Value="Hand" />
  70. <Setter Property="Background" Value="Transparent"/>
  71. <Setter Property="Template">
  72. <Setter.Value>
  73. <ControlTemplate TargetType="DataGridColumnHeader">
  74. <Grid>
  75. <Grid.ColumnDefinitions>
  76. <ColumnDefinition Width="*" />
  77. </Grid.ColumnDefinitions>
  78. <ContentPresenter Margin="0,0,0,0" VerticalAlignment="Center"
  79. HorizontalAlignment="Center" />
  80. <Path x:Name="SortArrow" Visibility="Collapsed" Data="M0,0 L1,0 0.5,1 z" Stretch="Fill"
  81. Grid.Column="0" Width="8" Height="6" Fill="Transparent" Margin="0,0,50,0"
  82. VerticalAlignment="Center" RenderTransformOrigin="1,1" />
  83. <Rectangle Width="1" Fill="#87CEFA" HorizontalAlignment="Right" Grid.ColumnSpan="1" />
  84. </Grid>
  85. </ControlTemplate>
  86. </Setter.Value>
  87. </Setter>
  88. <Setter Property="Height" Value="25" />
  89. </Style>
  90. <Style x:Key="datagridButton" TargetType="Button">
  91. <Setter Property="Background" Value="Transparent"/>
  92. <Setter Property="BorderBrush" Value="Transparent"/>
  93. <Setter Property="Foreground" Value="#1874CD"/>
  94. <Setter Property="FontSize" Value="18"/>
  95. </Style>
  96. </UserControl.Resources>
  97. <Grid>
  98. <Grid.ColumnDefinitions>
  99. </Grid.ColumnDefinitions>
  100. <Grid.RowDefinitions>
  101. <RowDefinition Height="50"/>
  102. <RowDefinition Height="*"/>
  103. <RowDefinition Height="100"/>
  104. </Grid.RowDefinitions>
  105. <TextBlock Text="用户管理" FontSize="28" Style="{DynamicResource CommonTextBlockStyle}"/>
  106. <DataGrid Grid.Row="1" Margin="30" AutoGenerateColumns="False" RowHeight="35" ItemsSource="{Binding userManager}"
  107. Background="Transparent"
  108. FrozenColumnCount="1"
  109. VerticalAlignment="Top"
  110. IsReadOnly="True"
  111. CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
  112. CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False">
  113. <DataGrid.Columns>
  114. <DataGridTemplateColumn Header="用户名" Width="200">
  115. <DataGridTemplateColumn.CellTemplate>
  116. <DataTemplate>
  117. <TextBlock Text="{Binding UserName}" FontSize="20" Foreground="White"/>
  118. </DataTemplate>
  119. </DataGridTemplateColumn.CellTemplate>
  120. </DataGridTemplateColumn>
  121. <DataGridTemplateColumn Header="最后登录时间" Width="300" >
  122. <DataGridTemplateColumn.CellTemplate>
  123. <DataTemplate>
  124. <TextBlock Text="{Binding LastLogInTime}" FontSize="20" Foreground="White"/>
  125. </DataTemplate>
  126. </DataGridTemplateColumn.CellTemplate>
  127. </DataGridTemplateColumn>
  128. <DataGridTemplateColumn Header="权限" Width="250">
  129. <DataGridTemplateColumn.CellTemplate>
  130. <DataTemplate>
  131. <Button Content="权限" Style="{DynamicResource datagridButton}"
  132. Command="{Binding DataContext.EditUserConfigCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}"
  133. CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid},Path=SelectedItem}"/>
  134. </DataTemplate>
  135. </DataGridTemplateColumn.CellTemplate>
  136. </DataGridTemplateColumn>
  137. <DataGridTemplateColumn Header="重置密码" Width="250">
  138. <DataGridTemplateColumn.CellTemplate>
  139. <DataTemplate>
  140. <Button Content="重置密码" Style="{DynamicResource datagridButton}" Command="{Binding DataContext.ChangePasswardCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}"
  141. CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid},Path=SelectedItem}"/>
  142. </DataTemplate>
  143. </DataGridTemplateColumn.CellTemplate>
  144. </DataGridTemplateColumn>
  145. <DataGridTemplateColumn Header="删除" Width="*">
  146. <DataGridTemplateColumn.CellTemplate>
  147. <DataTemplate>
  148. <Button Content="删除" Style="{DynamicResource datagridButton}"
  149. Command="{Binding DataContext.DeleteUserCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}"
  150. CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid},Path=SelectedItem}"/>
  151. </DataTemplate>
  152. </DataGridTemplateColumn.CellTemplate>
  153. </DataGridTemplateColumn>
  154. </DataGrid.Columns>
  155. </DataGrid>
  156. <Button Grid.Row="2"
  157. Height="50" Width="200"
  158. Background="#009DFF"
  159. BorderThickness="0"
  160. Command="{Binding AddNewUserCommand}"
  161. Content="添加新用户"
  162. FontSize="24"
  163. Foreground="White" />
  164. </Grid>
  165. </UserControl>