<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:controls="clr-namespace:HandyControl.Controls"
                    xmlns:interactivity="clr-namespace:HandyControl.Interactivity">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="../../Basic/Geometries.xaml"/>
        <ResourceDictionary Source="../../Basic/Behaviors.xaml"/>
        <ResourceDictionary Source="../../Basic/Sizes.xaml"/>
        <ResourceDictionary Source="../Base/BaseStyle.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <Style x:Key="TransferItemBaseStyle" BasedOn="{StaticResource BaseStyle}" TargetType="controls:TransferItem">
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisualMargin0}"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="CanDeselect" Value="True"/>
        <Setter Property="SelfManage" Value="True"/>
        <Setter Property="Padding" Value="10, 0"/>
        <Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}"/>
        <Setter Property="Margin" Value="5,0,5,5"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:TransferItem">
                    <Border x:Name="BorderRoot" Background="{DynamicResource RegionBrush}" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}">
                        <ContentPresenter x:Name="ContentPresenter" VerticalAlignment="Center" Margin="{TemplateBinding Padding}" ContentTemplate="{Binding ItemTemplate,RelativeSource={RelativeSource AncestorType=controls:TransferGroup}}"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter TargetName="BorderRoot" Property="Background" Value="{DynamicResource PrimaryBrush}"/>
                            <Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource TextIconBrush}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsOrigin" Value="True"/>
                    <Condition Property="IsTransferred" Value="False"/>
                </MultiTrigger.Conditions>
                <Setter Property="Visibility" Value="Visible"/>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsOrigin" Value="True"/>
                    <Condition Property="IsTransferred" Value="True"/>
                </MultiTrigger.Conditions>
                <Setter Property="Visibility" Value="Collapsed"/>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsOrigin" Value="False"/>
                    <Condition Property="IsTransferred" Value="True"/>
                </MultiTrigger.Conditions>
                <Setter Property="Visibility" Value="Visible"/>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsOrigin" Value="False"/>
                    <Condition Property="IsTransferred" Value="False"/>
                </MultiTrigger.Conditions>
                <Setter Property="Visibility" Value="Collapsed"/>
            </MultiTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="TransferGroupBaseStyle" TargetType="controls:TransferGroup">
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:TransferGroup">
                    <Border Background="{TemplateBinding Background}" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
                        <ScrollViewer Margin="0,5">
                            <StackPanel x:Name="PART_Panel"/>
                        </ScrollViewer>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="TransferBaseStyle" TargetType="controls:Transfer">
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="controls:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
        <Setter Property="ItemContainerStyle" Value="{StaticResource TransferItemBaseStyle}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:Transfer">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition MinWidth="200"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition MinWidth="200"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <controls:TransferGroup x:Name="PART_ItemsOrigin" Style="{StaticResource TransferGroupBaseStyle}" Grid.RowSpan="4" ItemTemplate="{TemplateBinding ItemTemplate}" ItemContainerStyle="{TemplateBinding ItemContainerStyle}"/>
                        <StackPanel Margin="32,0" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Row="0" Grid.RowSpan="4" Grid.Column="1">
                            <Button controls:IconElement.Geometry="{StaticResource LeftGeometry}" Command="interactivity:ControlCommands.Cancel"/>
                            <Button controls:IconElement.Geometry="{StaticResource RightGeometry}" Margin="0,10,0,0" Command="interactivity:ControlCommands.Selected"/>
                        </StackPanel>
                        <controls:TransferGroup x:Name="PART_ItemsSelected" Style="{StaticResource TransferGroupBaseStyle}" Grid.Row="0" Grid.RowSpan="4" Grid.Column="2" ItemTemplate="{TemplateBinding ItemTemplate}" ItemContainerStyle="{TemplateBinding ItemContainerStyle}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>