Files
qhmes/yy-admin-master/YY.Admin/Views/SysManage/UserEditDialogView.xaml

185 lines
11 KiB
XML

<UserControl x:Class="YY.Admin.Views.SysManage.UserEditDialogView"
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:hc="https://handyorg.github.io/handycontrol"
xmlns:local="clr-namespace:YY.Admin.Views.SysManage"
xmlns:core="clr-namespace:YY.Admin.Core;assembly=YY.Admin.Core"
xmlns:corefv="clr-namespace:YY.Admin.Core.FluentValidation;assembly=YY.Admin.Core"
xmlns:prism="http://prismlibrary.com/"
prism:ViewModelLocator.AutoWireViewModel="True"
mc:Ignorable="d"
Width="650"
MinHeight="300">
<Grid Background="{DynamicResource ThirdlyRegionBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<hc:SimplePanel Margin="20">
<TextBlock FontSize="18" Foreground="{DynamicResource PrimaryTextBrush}" Text="{Binding DialogTitle}" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<Button Width="22" Height="22" Command="hc:ControlCommands.Close" Style="{StaticResource ButtonIcon}" Foreground="{DynamicResource PrimaryBrush}" hc:IconElement.Geometry="{StaticResource ErrorGeometry}" Padding="0" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,4,4,0"/>
</hc:SimplePanel>
<hc:ScrollViewer Grid.Row="1" IsInertiaEnabled="True">
<StackPanel x:Name="RootPanel" Margin="20 0 20 0">
<hc:Row Gutter="10">
<hc:Col Span="12">
<hc:TextBox
Text="{Binding SysUser.Account, UpdateSourceTrigger=PropertyChanged}"
hc:InfoElement.TitleWidth="70"
Margin="0,0,0,20"
hc:InfoElement.ShowClearButton="True"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请输入账号"
hc:InfoElement.Title="账号"
hc:InfoElement.Necessary="True"
hc:InfoElement.Symbol="*"/>
</hc:Col>
<hc:Col Span="12" Visibility="{Binding IsAddMode, Converter={StaticResource Boolean2VisibilityConverter}}">
<hc:PasswordBox
UnsafePassword="{Binding SysUser.Password, UpdateSourceTrigger=PropertyChanged}"
IsSafeEnabled="False"
Margin="0,0,0,20"
ShowEyeButton="True"
hc:InfoElement.TitleWidth="70"
hc:InfoElement.Necessary="True"
hc:InfoElement.Symbol="*"
hc:InfoElement.ShowClearButton="True"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请输入密码"
hc:InfoElement.Title="密码"
hc:IsEnabled="{Binding IsAddMode}"/>
</hc:Col>
<hc:Col Span="12">
<hc:TextBox
Text="{Binding SysUser.RealName, UpdateSourceTrigger=PropertyChanged}"
hc:InfoElement.TitleWidth="70"
Margin="0,0,0,20"
hc:InfoElement.ShowClearButton="True"
hc:InfoElement.TitlePlacement="Left"
Validation.ErrorTemplate="{StaticResource BottomLeftErrorTemplate_ForInfoElement}"
hc:InfoElement.Necessary="True"
hc:InfoElement.Symbol="*"
corefv:FluentValidationHelper.SkipValidation="False"
hc:InfoElement.Placeholder="请输入姓名"
hc:InfoElement.Title="姓名"/>
</hc:Col>
<hc:Col Span="12">
<hc:TextBox
Text="{Binding SysUser.NickName, UpdateSourceTrigger=PropertyChanged}"
hc:InfoElement.TitleWidth="70"
Margin="0,0,0,20"
hc:InfoElement.ShowClearButton="True"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请输入昵称"
hc:InfoElement.Title="昵称"/>
</hc:Col>
<hc:Col Span="12">
<hc:ComboBox
SelectedItem="{Binding SysUser.Sex}"
Margin="0 0 0 20"
ItemsSource="{Binding GenderList}"
hc:InfoElement.TitleWidth="70"
hc:InfoElement.Necessary="True"
hc:InfoElement.Symbol="*"
hc:InfoElement.ShowClearButton="True"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请选择性别"
hc:InfoElement.Title="性别">
<hc:ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Converter={StaticResource EnumDescriptionConverter}}"/>
</DataTemplate>
</hc:ComboBox.ItemTemplate>
</hc:ComboBox>
</hc:Col>
<hc:Col Span="12">
<hc:DatePicker
SelectedDate="{Binding SysUser.Birthday}"
hc:InfoElement.TitleWidth="70"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请选择出生日期"
hc:InfoElement.Title="出生日期"
hc:InfoElement.ShowClearButton="True"
Margin="0 0 0 20"/>
</hc:Col>
<hc:Col Span="12">
<hc:NumericUpDown
Value="{Binding SysUser.Age}"
Minimum="0"
Maximum="150"
Style="{StaticResource NumericUpDownPlus}"
hc:InfoElement.TitleWidth="70"
hc:InfoElement.Necessary="True"
hc:InfoElement.Symbol="*"
hc:InfoElement.ShowClearButton="True"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请输入年龄"
hc:InfoElement.Title="年龄"
Margin="0 0 0 20"/>
</hc:Col>
<hc:Col Span="12">
<Grid Margin="0,0,0,20">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="70" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Text="状态" VerticalAlignment="Center" />
<!--<TextBlock Text="*" Foreground="Red" Margin="6,0,0,0" VerticalAlignment="Center"/>-->
</StackPanel>
<ItemsControl Grid.Column="1" ItemsSource="{Binding StatusOptions}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<RadioButton
Margin="0,0,15,0"
GroupName="StatusGroup"
Tag="{Binding}"
Content="{Binding Converter={StaticResource EnumDescriptionConverter}}"
Command="{Binding DataContext.StatusSelectedCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
CommandParameter="{Binding}">
<RadioButton.IsChecked>
<MultiBinding Converter="{StaticResource RadioButtonEnumMultiConverter}">
<!-- 当前选项 -->
<Binding Path="Tag" RelativeSource="{RelativeSource Self}"/>
<!-- SysUser.Status -->
<Binding Path="DataContext.SysUser.Status" RelativeSource="{RelativeSource AncestorType=UserControl}"/>
</MultiBinding>
</RadioButton.IsChecked>
</RadioButton>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</hc:Col>
</hc:Row>
</StackPanel>
</hc:ScrollViewer>
<!-- 按钮区域 -->
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center" Margin="20">
<Button Content="取消"
Command="{Binding CancelCommand}"
Style="{StaticResource ButtonDefault}"
Margin="0,0,15,0"
Width="100"/>
<Button Content="确定"
Click="Submit_Click"
Style="{StaticResource ButtonPrimary}"
Width="100"/>
</StackPanel>
</Grid>
</UserControl>