UserGroupDetailView.xaml 6.8 KB
Newer Older
cdy816's avatar
cdy816 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
<UserControl x:Class="DBInStudio.Desktop.View.UserGroupDetailView"
             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:DBInStudio.Desktop.View"
             xmlns:res="clr-namespace:DBInStudio.Desktop"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800" Background="White">
    <UserControl.Resources>
        <BooleanToVisibilityConverter x:Key="btv" />

        <Style x:Key="ListBoxItemContainerStyle1" TargetType="{x:Type ListBoxItem}">
            <Setter Property="SnapsToDevicePixels" Value="True"/>
            <Setter Property="Padding" Value="4,1"/>
            <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
            <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="BorderBrush" Value="Transparent"/>
            <Setter Property="BorderThickness" Value="1"/>

            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ListBoxItem}">
                        <Border x:Name="Bd" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
                            <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="32"/>
            <RowDefinition Height="*"/>
cdy816's avatar
cdy816 已提交
38
            <RowDefinition Height="32"/>
cdy816's avatar
cdy816 已提交
39
        </Grid.RowDefinitions>
cdy816's avatar
cdy816 已提交
40 41 42
        <Border BorderBrush="Gray" BorderThickness="0,0,0,1"/>
        <Label Content="{res:ResMarker UserList}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
        <ListBox ItemsSource="{Binding Users}" HorizontalContentAlignment="Stretch" SelectedItem="{Binding CurrentSelectedUser}" Grid.Row="1" HorizontalAlignment="Left" Width="300" Margin="5,5,0,0">
cdy816's avatar
cdy816 已提交
43 44 45 46 47 48 49 50 51
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid HorizontalAlignment="Stretch" Height="26">
                        <TextBlock Text="{Binding Name}" VerticalAlignment="Center" />
                        <TextBox Margin="-5,-1" Loaded="TextBox_Loaded" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" VerticalContentAlignment="Center" Visibility="{Binding IsEdit,Converter={StaticResource btv}}" Text="{Binding Name,Mode=TwoWay,UpdateSourceTrigger=LostFocus}" Keyboard.KeyDown="TextBox_KeyDown" />
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
cdy816's avatar
cdy816 已提交
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
        <Button Command="{Binding AddCommand}" Content="{res:ResMarker Add}" HorizontalAlignment="Left" Margin="5,0,0,0" Grid.Row="2" VerticalAlignment="Center" Width="94" Height="26">
            <Button.ContentTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal" Margin="0">

                        <Image Source="/Image/Add.png" Height="12" RenderOptions.BitmapScalingMode="NearestNeighbor" Margin="0,0,4,0"/>
                        <TextBlock Text="{Binding}" Grid.Column="1" />
                    </StackPanel>
                </DataTemplate>
            </Button.ContentTemplate>
        </Button>
        <Button Command="{Binding RemoveCommand}" Content="{res:ResMarker Remove}" HorizontalAlignment="Left" Margin="110,0,0,0" Grid.Row="2" VerticalAlignment="Center" Width="94" Height="26">
            <Button.ContentTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal" Margin="0">

                        <Image Source="/Image/Remove.png" Height="12" RenderOptions.BitmapScalingMode="NearestNeighbor" Margin="0,0,4,0"/>
                        <TextBlock Text="{Binding}" Grid.Column="1" />
                    </StackPanel>
                </DataTemplate>
            </Button.ContentTemplate>
        </Button>
cdy816's avatar
cdy816 已提交
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
        <Grid Grid.Row="1" Margin="310,0,0,0" DataContext="{Binding CurrentSelectedUser}" >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="391*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="32"/>
                <RowDefinition Height="32"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Label Content="{res:ResMarker UserName,:}" HorizontalAlignment="Left" Margin="10,0,0,0" VerticalAlignment="Center"/>
            <Label Content="{res:ResMarker Password,:}" HorizontalAlignment="Left" Margin="10,0,0,0" VerticalAlignment="Center" Grid.Row="1"/>
            <Label Content="{res:ResMarker Permission,:}" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Grid.Row="2"/>
            <TextBox IsEnabled="{Binding IsNew}" VerticalContentAlignment="Center" Text="{Binding Name,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Margin="10,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left" Width="300" Height="26" Grid.Column="1" />
            <!--<PasswordBox HorizontalAlignment="Left" VerticalContentAlignment="Center" Margin="10,0,0,0" VerticalAlignment="Center" Width="300" Height="26" Grid.Column="1" Password="123456"  Grid.Row="1" PasswordChanged="PasswordBox_PasswordChanged"/>-->
            <res:PasswordControl BorderBrush="Gray" BorderThickness="1" Password="{Binding Password,Mode=TwoWay}" Grid.Column="1" Grid.Row="1" Margin="10,0,0,0" Width="300" VerticalAlignment="Center" Height="26" HorizontalAlignment="Left"/>
cdy816's avatar
cdy816 已提交
90
            <ListBox ItemContainerStyle="{DynamicResource ListBoxItemContainerStyle1}"  ItemsSource="{Binding PermissionModel}" Grid.Column="1" Grid.Row="2" Margin="10,10,0,0" Width="300" HorizontalAlignment="Left" >
cdy816's avatar
cdy816 已提交
91 92 93 94 95 96 97 98
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <CheckBox IsChecked="{Binding IsSelected,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Content="{Binding Name}" />
                    </DataTemplate>
                </ListBox.ItemTemplate>

            </ListBox>
        </Grid>
cdy816's avatar
cdy816 已提交
99

cdy816's avatar
cdy816 已提交
100 101 102

    </Grid>
</UserControl>