<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:hc="clr-namespace:HandyControl.Controls"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:system="clr-namespace:System;assembly=mscorlib"
                    xmlns:tools="clr-namespace:HandyControl.Tools">

    <Style BasedOn="{StaticResource PropertyGridBaseStyle}" TargetType="hc:PropertyGrid"/>

    <Style x:Key="ComboBoxItemCapsuleBaseStyle" BasedOn="{x:Null}" TargetType="ComboBoxItem">
        <Setter Property="MinWidth" Value="40"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
        <Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="hc:BorderElement.CornerRadius" Value="0"/>
        <Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}"/>
        <Setter Property="Padding" Value="10,0"/>
        <Setter Property="Margin" Value="-1,0,0,0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ComboBoxItem">
                    <Border x:Name="BorderRoot" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
                        <ContentPresenter x:Name="contentPresenter" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" TextElement.Foreground="{TemplateBinding Foreground}" Focusable="False" HorizontalAlignment="Center" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsSelected" Value="True">
                <Setter Property="Panel.ZIndex" Value="{x:Static system:Int32.MaxValue}"/>
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
                <Setter Property="TextElement.Foreground" Value="{DynamicResource PrimaryBrush}"/>
            </Trigger>
            <Trigger Property="IsSelected" Value="true">
                <Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}"/>
                <Setter Property="Background" Value="{DynamicResource PrimaryBrush}"/>
                <Setter Property="TextElement.Foreground" Value="{DynamicResource TextIconBrush}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="ComboBoxItemCapsuleDefault" BasedOn="{StaticResource ComboBoxItemCapsuleBaseStyle}" TargetType="ComboBoxItem"/>

    <Style x:Key="ComboBoxItemCapsuleHorizontalFirst" BasedOn="{StaticResource ComboBoxItemCapsuleBaseStyle}" TargetType="ComboBoxItem">
        <Setter Property="hc:BorderElement.CornerRadius" Value="4,0,0,4"/>
        <Setter Property="Margin" Value="0"/>
    </Style>

    <Style x:Key="ComboBoxItemCapsuleHorizontalLast" BasedOn="{StaticResource ComboBoxItemCapsuleBaseStyle}" TargetType="ComboBoxItem">
        <Setter Property="hc:BorderElement.CornerRadius" Value="0,4,4,0"/>
    </Style>

    <Style x:Key="ComboBoxItemCapsuleSingle" BasedOn="{StaticResource ComboBoxItemCapsuleBaseStyle}" TargetType="ComboBoxItem">
        <Setter Property="hc:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}"/>
    </Style>

    <Style x:Key="ComboBoxItemCapsuleVerticalFirst" BasedOn="{StaticResource ComboBoxItemCapsuleBaseStyle}" TargetType="ComboBoxItem">
        <Setter Property="hc:BorderElement.CornerRadius" Value="4,4,0,0"/>
        <Setter Property="Margin" Value="0"/>
    </Style>

    <Style x:Key="ComboBoxItemCapsuleVerticalLast" BasedOn="{StaticResource ComboBoxItemCapsuleBaseStyle}" TargetType="ComboBoxItem">
        <Setter Property="hc:BorderElement.CornerRadius" Value="0,0,4,4"/>
    </Style>

    <tools:ComboBoxItemCapsuleStyleSelector x:Key="ComboBoxItemCapsuleStyleSelector"/>

    <Style x:Key="ComboBoxCapsule" BasedOn="{x:Null}" TargetType="ComboBox">
        <Setter Property="ItemContainerStyleSelector" Value="{StaticResource ComboBoxItemCapsuleStyleSelector}"/>
        <Setter Property="VerticalAlignment" Value="Top"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="ItemsPanel" Value="{StaticResource UniformHorizontalItemsPanelTemplate}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ComboBox">
                    <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <hc:HorizontalAlignmentPathTemplateSelector x:Key="HorizontalAlignmentPathTemplateSelector"/>
    <hc:VerticalAlignmentPathTemplateSelector x:Key="VerticalAlignmentPathTemplateSelector"/>

</ResourceDictionary>
