<UserControl x:Class="HxUserManagement.Views.UserCenter"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:local="clr-namespace:HxUserManagement.Views"
|
xmlns:str="clr-namespace:HxUserManagement.Properties"
|
xmlns:cls="clr-namespace:HxUserManagement.Classes"
|
mc:Ignorable="d"
|
d:DesignHeight="450" d:DesignWidth="800">
|
|
<UserControl.Resources>
|
<cls:StatusToStringConverter x:Key="statusToStringConverter"/>
|
<Style x:Key="dataGridColumnHeaderStyle" TargetType="DataGridColumnHeader">
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
<Setter Property="MinWidth" Value="0" />
|
<Setter Property="MinHeight" Value="28" />
|
<Setter Property="Foreground" Value="#323433" />
|
<Setter Property="FontSize" Value="16" />
|
<Setter Property="Cursor" Value="Hand" />
|
<Setter Property="Height" Value="40"/>
|
<Setter Property="Template">
|
<Setter.Value>
|
<ControlTemplate TargetType="DataGridColumnHeader">
|
<Border x:Name="BackgroundBorder" BorderThickness="0,0,0,0" BorderBrush="LightGray" Width="Auto" Background="{DynamicResource lightGrayBrush}">
|
<Grid >
|
<Grid.ColumnDefinitions>
|
<ColumnDefinition Width="*" />
|
</Grid.ColumnDefinitions>
|
<ContentPresenter Margin="0,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left"/>
|
</Grid>
|
</Border>
|
</ControlTemplate>
|
</Setter.Value>
|
</Setter>
|
</Style>
|
|
<Style x:Key="rowStyle" TargetType="DataGridRow">
|
<Setter Property="BorderThickness" Value="0"/>
|
<Setter Property="BorderBrush" Value="Transparent"/>
|
<Setter Property="Background" Value="White" />
|
<Setter Property="Height" Value="40"/>
|
<Setter Property="FontSize" Value="16" />
|
<Setter Property="Foreground" Value="Black" />
|
<Style.Triggers>
|
<Trigger Property="IsSelected" Value="True">
|
<Setter Property="Background" Value="{DynamicResource lightBlueBrush}"/>
|
</Trigger>
|
</Style.Triggers>
|
</Style>
|
|
<!--单元格样式触发-->
|
<Style x:Key="cellStyle" TargetType="DataGridCell">
|
<Setter Property="BorderThickness" Value="0"/>
|
<Setter Property="BorderBrush" Value="Transparent"/>
|
<Setter Property="Template">
|
<Setter.Value>
|
<ControlTemplate TargetType="DataGridCell">
|
<TextBlock TextAlignment="Left" VerticalAlignment="Center" Foreground="Black" >
|
<ContentPresenter />
|
</TextBlock>
|
</ControlTemplate>
|
</Setter.Value>
|
</Setter>
|
<Style.Triggers>
|
<Trigger Property="IsSelected" Value="True">
|
<Setter Property="Foreground" Value="Black"/>
|
<Setter Property="Background" Value="{DynamicResource lightBlueBrush}"/>
|
</Trigger>
|
</Style.Triggers>
|
</Style>
|
|
<Style x:Key="LinkButton" TargetType="Button">
|
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
<Setter Property="Template">
|
<Setter.Value>
|
<ControlTemplate TargetType="Button">
|
<TextBlock x:Name="tb" Foreground="{TemplateBinding Foreground}">
|
<ContentPresenter />
|
</TextBlock>
|
<ControlTemplate.Triggers>
|
<Trigger Property="IsMouseOver" Value="true">
|
<Setter Property="Foreground" TargetName="tb" Value="Blue" />
|
</Trigger>
|
<Trigger Property="IsEnabled" Value="false">
|
<Setter Property="Foreground" TargetName="tb" Value="Gray" />
|
</Trigger>
|
</ControlTemplate.Triggers>
|
</ControlTemplate>
|
</Setter.Value>
|
</Setter>
|
</Style>
|
</UserControl.Resources>
|
|
<Grid>
|
<Grid.RowDefinitions>
|
<RowDefinition Height="60"/>
|
<RowDefinition Height="*"/>
|
</Grid.RowDefinitions>
|
<Grid Margin="50 0" VerticalAlignment="Bottom">
|
<Grid.ColumnDefinitions>
|
<ColumnDefinition Width="0.5*"/>
|
<ColumnDefinition Width="1.5*"/>
|
<ColumnDefinition Width="1*"/>
|
<ColumnDefinition Width="1.5*"/>
|
<ColumnDefinition Width="1*"/>
|
<ColumnDefinition Width="1.5*"/>
|
<ColumnDefinition Width="1*"/>
|
<ColumnDefinition Width="1.5*"/>
|
</Grid.ColumnDefinitions>
|
<!--用户名-->
|
<TextBlock Text="{x:Static str:Resources.strUserName}" FontSize="16" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0 0 10 0"/>
|
<TextBlock Grid.Column="2" Text="{x:Static str:Resources.strPhone}" FontSize="16" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0 0 10 0"/>
|
<TextBlock Grid.Column="4" Text="{x:Static str:Resources.strRole}" FontSize="16" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0 0 10 0"/>
|
<TextBlock Grid.Column="6" Text="{x:Static str:Resources.strAccountStatus}" FontSize="16" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0 0 10 0"/>
|
|
<TextBox x:Name="textboxUserName" Grid.Column="1" Height="35" VerticalContentAlignment="Center" FontSize="16"
|
PreviewKeyDown="textboxUserName_PreviewKeyDown"/>
|
<TextBox x:Name="textboxPhone" Grid.Column="3" Height="35" VerticalContentAlignment="Center" FontSize="16"
|
PreviewKeyDown="textboxPhone_PreviewKeyDown"/>
|
<ComboBox x:Name="comboxRole" Grid.Column="5" Height="35" VerticalContentAlignment="Center" FontSize="16"
|
Background="White" IsEditable="False" DisplayMemberPath="Name" SelectionChanged="comboxRole_SelectionChanged"/>
|
<ComboBox x:Name="comboxAccountStatus" Grid.Column="7" Height="35" VerticalContentAlignment="Center" FontSize="16"
|
Background="White" IsEditable="False" SelectionChanged="comboxAccountStatus_SelectionChanged"/>
|
</Grid>
|
|
<Grid Grid.Row="1" Margin="20 0">
|
<DataGrid x:Name="datagrid" Grid.Row="1" AutoGenerateColumns="False" BorderThickness="0" FontSize="16"
|
RowHeaderWidth="0" BorderBrush="LightGray" CanUserResizeColumns="False" CanUserResizeRows="False" Margin="20 20" Background="White"
|
CanUserSortColumns="False" CanUserReorderColumns="False" CanUserAddRows="False" ColumnHeaderStyle="{DynamicResource dataGridColumnHeaderStyle}"
|
GridLinesVisibility="None" IsReadOnly="True" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}"
|
LoadingRow="datagrid_LoadingRow">
|
<DataGrid.Columns>
|
<DataGridTextColumn Width="80" Header="{x:Static str:Resources.strNo}"
|
Binding="{Binding Header, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}, Mode=FindAncestor}}" />
|
<DataGridTextColumn Width="*" Binding="{Binding UserName}" Header="{x:Static str:Resources.strUserName}"
|
/>
|
<DataGridTextColumn Width="*" Binding="{Binding Phone}" Header="{x:Static str:Resources.strPhone}"
|
/>
|
<DataGridTextColumn Width="*" Binding="{Binding Status,Converter={StaticResource statusToStringConverter}}" Header="{x:Static str:Resources.strAccountStatus}"
|
/>
|
<DataGridTextColumn Width="*" Binding="{Binding AuthorityName}" Header="{x:Static str:Resources.strRole}"
|
/>
|
<DataGridTextColumn Width="*" Binding="{Binding Remark}" Header="{x:Static str:Resources.strOperator}"
|
/>
|
<DataGridTextColumn Width="*" Binding="{Binding ModifyTime}" Header="{x:Static str:Resources.strOperateTime}"
|
/>
|
<DataGridTemplateColumn Header="{x:Static str:Resources.strOperation}" Width="*" >
|
<DataGridTemplateColumn.CellTemplate>
|
<DataTemplate>
|
<StackPanel Orientation="Horizontal">
|
<Button x:Name="btnEdit" Content="{x:Static str:Resources.strEdit}" Width="80" Height="25" Style="{DynamicResource LinkButton}"
|
Tag="{Binding Id}" Foreground="{DynamicResource blueBrush}" Click="btnEdit_Click"/>
|
|
<Button x:Name="btnDelete" Content="{x:Static str:Resources.strDelete}" Width="80" Height="25" Style="{DynamicResource LinkButton}"
|
Tag="{Binding Id}" Foreground="{DynamicResource blueBrush}" Click="btnDelete_Click"/>
|
|
<Button x:Name="btnPswdReset" Content="{x:Static str:Resources.strPSWDReset}" Width="80" Height="25" Style="{DynamicResource LinkButton}"
|
Tag="{Binding Id}" Foreground="{DynamicResource blueBrush}" Click="btnPswdReset_Click"/>
|
</StackPanel>
|
</DataTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn>
|
</DataGrid.Columns>
|
|
</DataGrid>
|
</Grid>
|
</Grid>
|
</UserControl>
|