167 lines
7.1 KiB
XML
167 lines
7.1 KiB
XML
<UserControl
|
|
x:Class="CapMachine.Wpf.Views.DialogUserView"
|
|
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:i="http://schemas.microsoft.com/xaml/behaviors"
|
|
xmlns:local="clr-namespace:CapMachine.Wpf.Views"
|
|
xmlns:localEx="clr-namespace:CapMachine.Wpf"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:prism="http://prismlibrary.com/"
|
|
Width="800"
|
|
Height="600"
|
|
mc:Ignorable="d">
|
|
<UserControl.Resources>
|
|
<localEx:BindingProxy x:Key="Proxy" Data="{Binding}" />
|
|
<Style x:Key="myHeaderStyle" TargetType="{x:Type GridViewColumnHeader}">
|
|
<Setter Property="FontSize" Value="24" />
|
|
<Setter Property="Width" Value="218" />
|
|
</Style>
|
|
<Style x:Key="myHeaderStyle1" TargetType="{x:Type GridViewColumnHeader}">
|
|
<Setter Property="FontSize" Value="16" />
|
|
<Setter Property="Background" Value="Transparent" />
|
|
<Setter Property="BorderThickness" Value="0" />
|
|
<Setter Property="BorderBrush" Value="Transparent" />
|
|
</Style>
|
|
</UserControl.Resources>
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="50" />
|
|
<RowDefinition />
|
|
<RowDefinition Height="auto" />
|
|
</Grid.RowDefinitions>
|
|
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
|
|
<Button
|
|
Margin="10,0"
|
|
Command="{Binding AddCmd}"
|
|
FontWeight="Bold"
|
|
Foreground="CadetBlue"
|
|
Style="{StaticResource MaterialDesignFlatAccentBgButton}">
|
|
<StackPanel Orientation="Horizontal">
|
|
<TextBlock
|
|
VerticalAlignment="Center"
|
|
FontFamily="/Assets/Fonts/#iconfont"
|
|
FontSize="14"
|
|
Foreground="CadetBlue"
|
|
Text=" " />
|
|
<TextBlock
|
|
VerticalAlignment="Center"
|
|
FontSize="14"
|
|
Text="新增" />
|
|
</StackPanel>
|
|
</Button>
|
|
<Button
|
|
Margin="10,0"
|
|
Command="{Binding CopyCmd}"
|
|
FontWeight="Bold"
|
|
Foreground="CadetBlue"
|
|
Style="{StaticResource MaterialDesignFlatAccentBgButton}">
|
|
<StackPanel Orientation="Horizontal">
|
|
<TextBlock
|
|
VerticalAlignment="Center"
|
|
FontFamily="/Assets/Fonts/#iconfont"
|
|
FontSize="14"
|
|
Foreground="CadetBlue"
|
|
Text="" />
|
|
<TextBlock
|
|
VerticalAlignment="Center"
|
|
FontSize="14"
|
|
Text="复制" />
|
|
</StackPanel>
|
|
</Button>
|
|
<Button
|
|
Margin="10,0"
|
|
Command="{Binding DeleteCmd}"
|
|
FontWeight="Bold"
|
|
Foreground="CadetBlue"
|
|
Style="{StaticResource MaterialDesignFlatAccentBgButton}">
|
|
<StackPanel Orientation="Horizontal">
|
|
<TextBlock
|
|
VerticalAlignment="Center"
|
|
FontFamily="/Assets/Fonts/#iconfont"
|
|
FontSize="14"
|
|
Foreground="CadetBlue"
|
|
Text="" />
|
|
<TextBlock
|
|
VerticalAlignment="Center"
|
|
FontSize="14"
|
|
Text="删除" />
|
|
</StackPanel>
|
|
</Button>
|
|
</StackPanel>
|
|
|
|
<Grid Grid.Row="1">
|
|
<DataGrid
|
|
x:Name="MainDatagrid"
|
|
Margin="5"
|
|
AutoGenerateColumns="False"
|
|
CanUserAddRows="False"
|
|
HeadersVisibility="Column"
|
|
ItemsSource="{Binding UserDtoItems}"
|
|
SelectionMode="Extended"
|
|
SelectionUnit="FullRow">
|
|
<DataGrid.Columns>
|
|
<DataGridTextColumn
|
|
Binding="{Binding Name}"
|
|
Header="名称"
|
|
IsReadOnly="{Binding Source={StaticResource Proxy}, Path=Data.IsComplete}" />
|
|
<DataGridTextColumn
|
|
Binding="{Binding Password}"
|
|
Header="密码"
|
|
IsReadOnly="{Binding Source={StaticResource Proxy}, Path=Data.IsComplete}" />
|
|
<DataGridTemplateColumn Header="等级" IsReadOnly="{Binding Source={StaticResource Proxy}, Path=Data.IsComplete}">
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
<DataTemplate>
|
|
<TextBlock VerticalAlignment="Center" Text="{Binding Level}" />
|
|
</DataTemplate>
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
<DataGridTemplateColumn.CellEditingTemplate>
|
|
<DataTemplate>
|
|
<ComboBox
|
|
MinWidth="100"
|
|
ItemsSource="{Binding Source={StaticResource Proxy}, Path=Data.UserLevelOptions}"
|
|
SelectedItem="{Binding Level, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
|
</DataTemplate>
|
|
</DataGridTemplateColumn.CellEditingTemplate>
|
|
</DataGridTemplateColumn>
|
|
<DataGridCheckBoxColumn
|
|
Binding="{Binding IsEnable}"
|
|
Header="是否启用"
|
|
IsReadOnly="{Binding Source={StaticResource Proxy}, Path=Data.IsComplete}" />
|
|
</DataGrid.Columns>
|
|
<i:Interaction.Triggers>
|
|
<i:EventTrigger EventName="SelectionChanged">
|
|
<prism:InvokeCommandAction Command="{Binding GridSelectionChangedCmd}" CommandParameter="{Binding ElementName=MainDatagrid, Path=SelectedItem}" />
|
|
</i:EventTrigger>
|
|
</i:Interaction.Triggers>
|
|
</DataGrid>
|
|
</Grid>
|
|
|
|
<TextBlock
|
|
Grid.Row="2"
|
|
Margin="10,0,200,0"
|
|
VerticalAlignment="Center"
|
|
FontSize="26"
|
|
Foreground="Black"
|
|
Text="{Binding CurSelectedItem.Name}" />
|
|
|
|
|
|
<StackPanel
|
|
Grid.Row="2"
|
|
HorizontalAlignment="Right"
|
|
Orientation="Horizontal">
|
|
|
|
<Button
|
|
Margin="10,10"
|
|
Command="{Binding SaveCmd}"
|
|
Content="确定"
|
|
Foreground="White" />
|
|
<Button
|
|
Margin="10,10"
|
|
Command="{Binding CancelCmd}"
|
|
Content="取消"
|
|
Foreground="White" />
|
|
</StackPanel>
|
|
</Grid>
|
|
</UserControl>
|