<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >

    <Style x:Key="UserButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Border x:Name="border" CornerRadius="5" BorderThickness="0" BorderBrush="Black" 
                                Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}">
                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Opacity" Value="0.8" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="border" Property="Background" Value="#FFCFCFCF" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="UserMenuItemStyle" TargetType="{x:Type MenuItem}">
        <Setter Property="Cursor" Value="Hand" />
    </Style>

    <Style x:Key="UserLabelStyle" TargetType="{x:Type Label}">
        <Setter Property="Cursor" Value="Hand" />
    </Style>

    <Style x:Key="UserGridStyle" TargetType="{x:Type Grid}">
        <Setter Property="Cursor" Value="Hand" />
    </Style>

    <Style x:Key="UserComboBoxItem" TargetType="{x:Type ComboBoxItem}">
        <Setter Property="Cursor" Value="Hand" />
    </Style>

    <!--<Style x:Key="UserComboBox" TargetType="{x:Type ComboBox}">
        <Setter Property="Cursor" Value="Hand" />
    </Style>-->

    <Style x:Key="UserTextBox" TargetType="{x:Type TextBox}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBox}">
                    <Grid FocusManager.FocusedElement="{Binding ElementName=border}">
                        <Border x:Name="border" CornerRadius="5" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                            <ScrollViewer x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--ComboBox-->
    <!--ComBoBox toggleButton样式-->
    <ControlTemplate x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
        <Grid Height="25" >
            <Border Grid.Column="1" Background="Transparent" Opacity="0" Cursor="Hand"/>
            <Border Padding="0 0 5 0">
                <Path x:Name="Arrow" Grid.Column="1" Data="M 0 0  6 6 12 0 Z" VerticalAlignment="Center" HorizontalAlignment="Right" Stretch="None" Fill="#FFB1B1B1" />
            </Border>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsChecked" Value="true">
                <Setter TargetName="Arrow" Property="RenderTransform">
                    <Setter.Value>
                        <RotateTransform   CenterX="6" CenterY="3" Angle="180"></RotateTransform>
                    </Setter.Value>
                </Setter>
                <Setter TargetName="Arrow" Property="Margin" Value="0 0 0 2"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    <Style x:Key="UserComboBox"  TargetType="{x:Type ComboBox}">
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="ItemContainerStyle">
            <Setter.Value>
                <Style TargetType="ComboBoxItem">
                    <Setter Property="Cursor" Value="Hand" />
                    <Setter Property="Height" Value="auto"/>
                    <Setter Property="MinHeight" Value="25"/>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate  TargetType="{x:Type ComboBoxItem}">
                                <Grid Height="{TemplateBinding Height}" Width="{TemplateBinding Width}">
                                    <Border x:Name="_borderbg" Background="Transparent"/>
                                    <TextBlock Margin="3 0 3 0" VerticalAlignment="Center" x:Name="_txt" Foreground="#e6e6e6" Text="{Binding Content,RelativeSource={RelativeSource TemplatedParent}}" HorizontalAlignment="Center"/>
                                    <Border x:Name="_border" Background="White" Opacity="0"/>
                                </Grid>
                                <ControlTemplate.Triggers>
                                    <Trigger Property="IsSelected" Value="true">
                                        <Setter TargetName="_borderbg" Property="Background" Value="#FF69B6FF" />
                                        <Setter TargetName="_txt" Property="Foreground" Value="White"/>
                                    </Trigger>
                                    <MultiTrigger>
                                        <MultiTrigger.Conditions>
                                            <Condition Property="IsSelected" Value="false"/>
                                            <Condition Property="IsMouseOver" Value="true"/>
                                        </MultiTrigger.Conditions>
                                        <Setter TargetName="_borderbg" Property="Background" Value="#FFC1C1C1" />
                                        <Setter TargetName="_txt" Property="Foreground" Value="White"/>
                                    </MultiTrigger>

                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ComboBox}">
                    <Border Padding="0">
                        <Grid Background="Transparent">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="0.7*"/>
                                <ColumnDefinition Width="20" MaxWidth="30"/>
                            </Grid.ColumnDefinitions>
                            <Border x:Name="_borderbg"  Grid.Column="0" Grid.ColumnSpan="2" Background="{TemplateBinding Background}" BorderThickness="1" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="3"/>
                            <ContentPresenter Grid.Column="0" HorizontalAlignment="Center" Margin="3" x:Name="ContentSite" VerticalAlignment="Center" Content="{TemplateBinding SelectionBoxItem}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" IsHitTestVisible="False"/>

                            <!--ToggleButton 已数据绑定到 ComboBox 本身以切换 IsDropDownOpen-->
                            <ToggleButton Grid.Column="0"  Grid.ColumnSpan="2" Template="{StaticResource ComboBoxToggleButton}"  x:Name="ToggleButton" Focusable="false" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press"/>
                            <!--必须将 TextBox 命名为 PART_EditableTextBox，否则 ComboBox 将无法识别它-->
                            <TextBox Visibility="Hidden" BorderThickness="0" Margin="2 0 0 0" x:Name="PART_EditableTextBox"  VerticalAlignment="Center" Focusable="True" Background="Transparent" IsReadOnly="{TemplateBinding IsReadOnly}"/>
                            <!--Popup 可显示 ComboBox 中的项列表。IsOpen 已数据绑定到通过 ComboBoxToggleButton 来切换的 IsDropDownOpen-->
                            <Popup IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom" x:Name="Popup" Focusable="False" AllowsTransparency="True" PopupAnimation="Slide">
                                <Grid MinWidth="{TemplateBinding ActualWidth}" x:Name="DropDown" SnapsToDevicePixels="True">
                                    <Border x:Name="DropDownBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1"/>
                                    <ScrollViewer Margin="1"  SnapsToDevicePixels="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" CanContentScroll="True">
                                        <!--StackPanel 用于显示子级，方法是将 IsItemsHost 设置为 True-->
                                        <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" Background="White"/>
                                    </ScrollViewer>
                                </Grid>
                            </Popup>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEditable" Value="true">
                            <Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible" />
                        </Trigger>
                        <!--<MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="false"/>
                                <Condition Property="IsMouseOver" Value="true"/>
                            </MultiTrigger.Conditions>
                            <Setter TargetName="_borderbg" Property="Background" Value="#FF1492C0" />
                            <Setter Property="Foreground" Value="White"/>
                        </MultiTrigger>-->
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>