<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:smart="clr-namespace:SmartUI.Controls">
    <Style TargetType="{x:Type smart:ComboBoxControl}">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderBrush" Value="{DynamicResource PrimaryBorderGaryColor}"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Width" Value="150"/>
        <Setter Property="Height" Value="35"/>
        <Setter Property="Margin" Value="0,3"/>
        <Setter Property="Foreground" Value="{DynamicResource PrimaryTextColor}"/>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
        <Setter Property="Padding" Value="2" />
        <Setter Property="VerticalContentAlignment" Value="Top" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="ScrollViewer.CanContentScroll" Value="True" />
        <Setter Property="ScrollViewer.PanningMode" Value="Both" />
        <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
        <Setter Property="IsDropDownOpen" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate  TargetType="{x:Type smart:ComboBoxControl}">
                    <Grid>
                        <Border x:Name="border" Background="White" Margin="0 0 5 0" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="4">
                          <DockPanel LastChildFill="True" VerticalAlignment="Center" Cursor="Hand">
                                <smart:PackIcon x:Name="icon" DockPanel.Dock="Right" Width="16" Height="16" Kind="KeyboardArrowDown" Foreground="{TemplateBinding BorderBrush}" Margin="5"/>
                                <TextBlock Text="{TemplateBinding Text}" Margin="5 0" VerticalAlignment="Center"/>
                          </DockPanel>
                        </Border>
                        <Popup x:Name="popup" IsOpen="{TemplateBinding IsDropDownOpen}" Width="{TemplateBinding Width}" Height="Auto" HorizontalAlignment="Left" VerticalOffset="1" MinHeight="100" MaxHeight="300" AllowsTransparency="True">
                            <Border Background="White" CornerRadius="4" Padding="0 5" Margin="0 0 5 5" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1">
                                <Border.Effect>
                                    <DropShadowEffect Color="LightGray" Opacity="0.3"/>
                                </Border.Effect>
                                <ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Auto" CanContentScroll="True">
                                    <ItemsPresenter SnapsToDevicePixels="True"/>
                                </ScrollViewer>                                
                            </Border>
                        </Popup>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsDropDownOpen" Value="True">
                            <Setter TargetName="icon" Property="Kind" Value="KeyboardArrowUp"/>
                        </Trigger>
                        <!--<Trigger Property="Validation.HasError" Value="true">
                            <Setter Property="ToolTip" Value="{Binding RelativeSource=
                            {x:Static RelativeSource.Self}, 
                            Path=(Validation.Errors)[0].ErrorContent}"/>
                            <Setter Property="BorderBrush" Value="Red"/>
                        </Trigger>-->
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Validation.ErrorTemplate">
            <Setter.Value>
                <ControlTemplate>
                    <Grid>
                        <DockPanel LastChildFill="True">
                            <TextBlock Margin="5 2" FontSize="12"  Text="{Binding [0].ErrorContent}" Foreground="Red" DockPanel.Dock="Bottom" VerticalAlignment="Center"/>
                            <AdornedElementPlaceholder Name="PlaceHolder"/>
                        </DockPanel>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="ComboBoxItem">
        <Setter Property="Width" Value="Auto"/>
        <Setter Property="Height" Value="30"/>
        <Setter Property="Padding" Value="3"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ComboBoxItem">
                    <Border Background="{TemplateBinding Background}">
                        <ContentControl Content="{TemplateBinding Content}" HorizontalAlignment="Center" VerticalAlignment="Center" SnapsToDevicePixels="True" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Background" Value="{DynamicResource BgHoverColor}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>