<UserControl x:Class="BaseModule.Views.ModifyRolesDialog"
             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:BaseModule.Views"
             xmlns:prism="http://prismlibrary.com/"
             prism:ViewModelLocator.AutoWireViewModel="True"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Txgy.EWS.Client.Assets;component/Styles/BaseResources.xaml"/>
                <ResourceDictionary Source="/Txgy.EWS.Client.Assets;component/Styles/ButtonStyles.xaml"/>
                <ResourceDictionary>
                    <Style TargetType="CheckBox" x:Key="RoleItemButtonStyle">
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="CheckBox">
                                    <Grid Background="Transparent">
                                        <Border BorderBrush="#EEE" BorderThickness="1" CornerRadius="3" Name="back">
                                            <TextBlock Text="{TemplateBinding Content}" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="8,5"/>
                                        </Border>
                                    </Grid>
                                    <ControlTemplate.Triggers>
                                        <Trigger Property="IsChecked" Value="True">
                                            <Setter Property="Background" Value="orange" TargetName="back"/>
                                        </Trigger>
                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                        <Style.Triggers>
                            <Trigger Property="IsChecked" Value="True">
                                <Setter Property="Foreground" Value="White"/>
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                </ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <prism:Dialog.WindowStyle>
        <Style TargetType="Window">
            <Setter Property="Width" Value="500"/>
            <Setter Property="Height" Value="450"/>
        </Style>
    </prism:Dialog.WindowStyle>
    <Grid Margin="0,20,0,0">
        <Grid.RowDefinitions>
            <RowDefinition Height="70"/>
            <RowDefinition/>
            <RowDefinition Height="70"/>
        </Grid.RowDefinitions>
        <TextBlock Text="{Binding Title}" FontSize="20" VerticalAlignment="Center" Foreground="#888" Margin="10,0"/>

        <ItemsControl ItemsSource="{Binding Roles}" Grid.Row="1" Margin="20">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel/>
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <CheckBox Content="{Binding RoleName}" DataContext="{Binding}"
                              IsChecked="{Binding IsSelected}" Margin="8,5"
                              Style="{StaticResource RoleItemButtonStyle}"/>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>

        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Row="2" Margin="20,0">
            <Button Content="确定" Width="100" Height="30" Margin="5,0" 
                    Style="{StaticResource NormalButtonStyle}"
                    Background="#FF0ABEFF"
                    Command="{Binding ConfirmCommand}"/>
            <Button Content="取消" Width="100" Height="30"
                    Style="{StaticResource NormalButtonStyle}"
                    Background="#DDD" Foreground="#666"
                    Command="{Binding CancelCommand}"/>
        </StackPanel>
    </Grid>
</UserControl>
