UserAddOrEditView.xaml 4.42 KB
<Window
    x:Class="HHECS.RobotTool.View.AccountView.UserAddOrEditView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:hc="https://handyorg.github.io/handycontrol"
    xmlns:local="clr-namespace:HHECS.RobotTool.View.AccountView"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:viewmodel="clr-namespace:HHECS.RobotTool.ViewModel.AccountVM"
    Title="新增用户"
    Width="600"
    Height="400"
    d:DataContext="{d:DesignInstance Type=viewmodel:UserAddOrEditVM}"
    WindowStartupLocation="CenterScreen"
    mc:Ignorable="d">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="50" />
        </Grid.RowDefinitions>
        <hc:UniformSpacingPanel
            Grid.Row="0"
            ChildWrapping="Wrap"
            Orientation="Horizontal"
            Spacing="10">
            <TextBox
                MinWidth="260"
                hc:InfoElement.Necessary="True"
                hc:InfoElement.Title="用户账号"
                hc:InfoElement.TitlePlacement="Left"
                hc:InfoElement.TitleWidth="70"
                Style="{StaticResource TextBoxExtend}"
                Text="{Binding User.Account, UpdateSourceTrigger=PropertyChanged}" />
            <TextBox
                MinWidth="260"
                hc:InfoElement.Necessary="True"
                hc:InfoElement.Title="用户名称"
                hc:InfoElement.TitlePlacement="Left"
                hc:InfoElement.TitleWidth="70"
                Style="{StaticResource TextBoxExtend}"
                Text="{Binding User.UserName, UpdateSourceTrigger=PropertyChanged}" />
            <TextBox
                MinWidth="260"
                hc:InfoElement.Necessary="True"
                hc:InfoElement.Title="用户密码"
                hc:InfoElement.TitlePlacement="Left"
                hc:InfoElement.TitleWidth="70"
                Style="{StaticResource TextBoxExtend}"
                Text="{Binding User.Password, UpdateSourceTrigger=PropertyChanged}" />
            <TextBox
                MinWidth="260"
                hc:InfoElement.Necessary="False"
                hc:InfoElement.Title="备注"
                hc:InfoElement.TitlePlacement="Left"
                hc:InfoElement.TitleWidth="70"
                Style="{StaticResource TextBoxExtend}"
                Text="{Binding User.Description, UpdateSourceTrigger=PropertyChanged}" />
            <CheckBox Content="是否启用" IsChecked="{Binding User.Enable, UpdateSourceTrigger=PropertyChanged}" />
        </hc:UniformSpacingPanel>
        <GroupBox
            Grid.Row="1"
            Padding="5"
            Header="角色"
            Style="{StaticResource GroupBoxTab.Small}">
            <Border Background="{DynamicResource RegionBrush}" CornerRadius="4">
                <ItemsControl ItemsSource="{Binding Roles}">
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <hc:UniformSpacingPanel
                                VerticalAlignment="Top"
                                Orientation="Horizontal"
                                Spacing="10" />
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <CheckBox Content="{Binding Name}" IsChecked="{Binding IsSelected, UpdateSourceTrigger=PropertyChanged}" />
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </Border>
        </GroupBox>
        <hc:UniformSpacingPanel
            Grid.Row="2"
            HorizontalAlignment="Center"
            Spacing="60">
            <Button
                hc:IconElement.Geometry="{StaticResource SaveGeometry}"
                Command="{Binding SaveCommand}"
                Content="保存"
                Style="{StaticResource ButtonPrimary}" />
            <Button
                hc:IconElement.Geometry="{StaticResource CloseGeometry}"
                Command="{Binding CancelCommand}"
                Content="取消"
                Style="{StaticResource ButtonDefault}" />
        </hc:UniformSpacingPanel>
    </Grid>
</Window>