WinUserAddOrEdit.xaml 6.05 KB
<Window
     x:Class="HHECS.View.UserOperation.WinUserAddOrEdit"
        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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:HHECS.View.UserOperation"
        mc:Ignorable="d"
        Title="UserAddOrEdit" Height="381.2" Width="388.105" ResizeMode="NoResize">
    <Window.Resources>
        <Style TargetType="StackPanel">
            <Setter Property="Margin" Value="10,0,20,0"/>
            <Setter Property="HorizontalAlignment" Value="Right"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="Orientation" Value="Horizontal"/>
        </Style>
        <Style TargetType="TextBox" BasedOn="{StaticResource TextBoxStyle}">
            <Setter Property="Width" Value="80"/>
        </Style>
        <DataTemplate x:Key="select">
            <CheckBox x:Name="ch" IsChecked="{Binding Selected}"/>
        </DataTemplate>
    </Window.Resources>
    <Grid x:Name="GridMain">
        <Grid.RowDefinitions>
            <RowDefinition></RowDefinition>
            <RowDefinition></RowDefinition>
            <RowDefinition></RowDefinition>
            <RowDefinition></RowDefinition>
            <RowDefinition></RowDefinition>
            <RowDefinition></RowDefinition>
            <RowDefinition></RowDefinition>
            <RowDefinition></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition></ColumnDefinition>
            <ColumnDefinition></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <StackPanel Grid.Column="0" Grid.Row="0" >
            <TextBlock>用户编码:</TextBlock>
            <TextBox x:Name="TxtUserCode" Text="{Binding UserCode,Mode=TwoWay}">
                <TextBox.Resources>
                    <Style TargetType="{x:Type Border}">
                        <Setter Property="CornerRadius" Value="5"></Setter>
                    </Style>
                </TextBox.Resources>
            </TextBox>
        </StackPanel>
        <StackPanel Grid.Column="1" Grid.Row="0" >
            <TextBlock>用户名:</TextBlock>
            <TextBox x:Name="TxtUserName" Text="{Binding UserName,Mode=TwoWay}">
                <TextBox.Resources>
                    <Style TargetType="{x:Type Border}">
                        <Setter Property="CornerRadius" Value="5"></Setter>
                    </Style>
                </TextBox.Resources>
            </TextBox>
        </StackPanel>
        <StackPanel Grid.Column="0" Grid.Row="1" >
            <TextBlock>密码:</TextBlock>
            <TextBox Text="{Binding Password,Mode=TwoWay}">
                <TextBox.Resources>
                    <Style TargetType="{x:Type Border}">
                        <Setter Property="CornerRadius" Value="5"></Setter>  
                    </Style>
                </TextBox.Resources>
            </TextBox>
        </StackPanel>
        <StackPanel Grid.Column="1" Grid.Row="1" >
            <TextBlock>部门:</TextBlock>
            <TextBox Text="{Binding Department,Mode=TwoWay}">
                <TextBox.Resources>
                    <Style TargetType="{x:Type Border}">
                        <Setter Property="CornerRadius" Value="5"></Setter>
                    </Style>
                </TextBox.Resources>
            </TextBox>
        </StackPanel>
        <StackPanel Grid.Column="0" Grid.Row="2" >
            <TextBlock>地址:</TextBlock>
            <TextBox Text="{Binding Address,Mode=TwoWay}">
                <TextBox.Resources>
                    <Style TargetType="{x:Type Border}">
                        <Setter Property="CornerRadius" Value="5"></Setter>
                    </Style>
                </TextBox.Resources>
            </TextBox>
        </StackPanel>
        <StackPanel Grid.Column="1" Grid.Row="2" >
            <TextBlock>电话:</TextBlock>
            <TextBox Text="{Binding Phone,Mode=TwoWay}">
                <TextBox.Resources>
                    <Style TargetType="{x:Type Border}">
                        <Setter Property="CornerRadius" Value="5"></Setter>
                    </Style>
                </TextBox.Resources>
            </TextBox>
        </StackPanel>
        <StackPanel Grid.Column="0" Grid.Row="3" >
            <TextBlock>备注:</TextBlock>
            <TextBox Text="{Binding Remark,Mode=TwoWay}">
                <TextBox.Resources>
                    <Style TargetType="{x:Type Border}">
                        <Setter Property="CornerRadius" Value="5"></Setter>
                    </Style>
                </TextBox.Resources>
            </TextBox>
        </StackPanel>
        <StackPanel Grid.Column="1" Grid.Row="3" >
            <TextBlock>禁用:</TextBlock>
            <CheckBox IsChecked="{Binding Disable,Mode=TwoWay}"></CheckBox>
        </StackPanel>
        <GroupBox Grid.Row="4" Grid.RowSpan="3" Grid.Column="0" Grid.ColumnSpan="2"  Header="角色" Padding="5"  HorizontalAlignment="Left" VerticalAlignment="Top" Width="{Binding ElementName=GridMain,Path=ActualWidth}">
            <ListView x:Name="ListViewMain">
                <ListView.View>
                    <GridView>
                        <GridView.Columns>
                            <GridViewColumn Header="选择"  CellTemplate="{StaticResource select}" Width="40"/>
                            <GridViewColumn Header="Id" DisplayMemberBinding="{Binding Id}" Width="100"/>
                            <GridViewColumn Header="角色名" DisplayMemberBinding="{Binding RoleName}" Width="100"/>
                        </GridView.Columns>
                    </GridView>
                </ListView.View>
            </ListView>
        </GroupBox>
        <StackPanel Orientation="Horizontal" Grid.Row="7" Grid.Column="1">
            <Button x:Name="BtnSave" Click="BtnSave_Click">保存</Button>
            <Button x:Name="BtnCancel" Click="BtnCancel_Click">取消</Button>
        </StackPanel>
    </Grid>
</Window>