<Page x:Class="CCDCountWpf.WpfPage.UserManagementPage"
      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:CCDCountWpf.WpfPage"
      mc:Ignorable="d" 
      d:DesignHeight="450" d:DesignWidth="800"
      Title="UserManagementPage">
    <Grid>
        <Grid Height="30" VerticalAlignment="Top">
            <StackPanel Orientation="Horizontal">
                <Button x:Name="AddUserBtn" HorizontalAlignment="Left" Height="25" Width="25" Background="{x:Null}" Click="AddUserBtn_Click">
                    <StackPanel Orientation="Vertical">
                        <Image  Source="/FromImage/用户增加.png"/>
                    </StackPanel>
                </Button>
                <Button x:Name="DeleteUserBtn" HorizontalAlignment="Left" Height="25" Width="25" Background="{x:Null}" Click="DeleteUserBtn_Click">
                    <StackPanel Orientation="Vertical">
                        <Image  Source="/FromImage/用户删除.png"/>
                    </StackPanel>
                </Button>
                <Button x:Name="ChangeUserBtn" HorizontalAlignment="Left" Height="25" Width="25" Background="{x:Null}" Click="ChangeUserBtn_Click">
                    <StackPanel Orientation="Vertical">
                        <Image  Source="/FromImage/用户修改.png"/>
                    </StackPanel>
                </Button>
            </StackPanel>
        </Grid>
        <DataGrid x:Name="UserMessageDataGrid" ItemsSource="{Binding UserMesDataModels}" AutoGenerateColumns="False" Margin="0,30,0,0" SelectionMode="Single"
            SelectionUnit="FullRow" SelectionChanged="DataGrid_SelectionChanged">
            <!-- 添加行样式 -->
            <DataGrid.RowStyle>
                <Style TargetType="DataGridRow">
                    <Style.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <!-- 设置蓝色背景和白色文字 -->
                            <Setter Property="Background" Value="DodgerBlue"/>
                            <Setter Property="Foreground" Value="White"/>
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </DataGrid.RowStyle>
            <DataGrid.Columns>
                <DataGridTextColumn Header="ID" Binding="{Binding Id}" />
                <DataGridTextColumn Header="用户名" Binding="{Binding UserName}" />
                <DataGridTextColumn Header="用户信息" Binding="{Binding UserMes}" />
            </DataGrid.Columns>
        </DataGrid>
    </Grid>
</Page>
