<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:system="clr-namespace:System;assembly=mscorlib"
                    xmlns:interactivity="clr-namespace:HandyControl.Interactivity">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="../../Basic/Converters.xaml"/>
        <ResourceDictionary Source="../../Basic/Geometries.xaml"/>
        <ResourceDictionary Source="../TextBlock.xaml"/>
        <ResourceDictionary Source="../Button.xaml"/>
        <ResourceDictionary Source="../ToggleButton.xaml"/>
        <ResourceDictionary Source="../TextBox.xaml"/>
    </ResourceDictionary.MergedDictionaries>
    
    <Style x:Key="PasswordBoxBaseStyle" TargetType="PasswordBox">
        <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="controls:BorderElement.CornerRadius" Value="4"/>
        <Setter Property="PasswordChar" Value="●"/>
        <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="AllowDrop" Value="true"/>
        <Setter Property="Padding" Value="6"/>
        <Setter Property="Height" Value="30"/>
        <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="PasswordBox">
                    <Border x:Name="border" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                        <ScrollViewer Template="{TemplateBinding Padding}" Margin="0,0,0,1" x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Opacity" TargetName="border" Value="0.4"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource SecondaryBorderBrush}"/>
                        </Trigger>
                        <Trigger Property="IsFocused" Value="true">
                            <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource PrimaryBrush}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate x:Key="PasswordBoxExtendTopTemplate" TargetType="PasswordBox">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="{Binding Path=(controls:InfoElement.ContentHeight),RelativeSource={RelativeSource TemplatedParent}}"/>
            </Grid.RowDefinitions>
            <StackPanel Visibility="{Binding Path=(controls:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource String2VisibilityConverter}}" Orientation="Horizontal" Margin="7,4">
                <TextBlock Margin="1,0,0,0" Text="{Binding Path=(controls:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent}}"/>
                <ContentPresenter TextElement.Foreground="{DynamicResource DangerBrush}" Margin="4,0,0,0" Content="{Binding Path=(controls:InfoElement.Symbol),RelativeSource={RelativeSource TemplatedParent}}" Visibility="{Binding Path=(controls:InfoElement.Necessary),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}"/>
            </StackPanel>
            <Border x:Name="border" Grid.Row="1" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True"/>
            <TextBlock x:Name="placeholder" Visibility="Collapsed" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="8" Grid.Row="1" HorizontalAlignment="Stretch" Style="{StaticResource TextBlockDefaultThiLight}" Text="{Binding Path=(controls:InfoElement.Placeholder),RelativeSource={RelativeSource TemplatedParent}}"/>
            <ScrollViewer Padding="6,0" Margin="0,1,0,2" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Grid.Row="1" x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="controls:PasswordBoxMonitor.PasswordLength" Value="0">
                <Setter Property="Visibility" TargetName="placeholder" Value="Visible"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
                <Setter Property="Opacity" Value="0.4" TargetName="border"/>
                <Setter Property="Opacity" Value="0.4" TargetName="placeholder"/>
                <Setter Property="Opacity" Value="0.4" TargetName="PART_ContentHost"/>
            </Trigger>
            <Trigger Property="IsMouseOver" Value="true" SourceName="PART_ContentHost">
                <Setter Property="BorderBrush" Value="{DynamicResource SecondaryBorderBrush}"/>
            </Trigger>
            <Trigger Property="IsFocused" Value="true">
                <Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="PasswordBoxExtendLeftTemplate" TargetType="PasswordBox">
        <Grid Height="{Binding Path=(controls:InfoElement.ContentHeight),RelativeSource={RelativeSource TemplatedParent}}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="{Binding Path=(controls:InfoElement.TitleWidth),RelativeSource={RelativeSource TemplatedParent}}"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <StackPanel Visibility="{Binding Path=(controls:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource String2VisibilityConverter}}" Orientation="Horizontal" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="0,7,6,8">
                <TextBlock Text="{Binding Path=(controls:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent}}"/>
                <ContentPresenter TextElement.Foreground="{DynamicResource DangerBrush}" Margin="4,0,0,0" Content="{Binding Path=(controls:InfoElement.Symbol),RelativeSource={RelativeSource TemplatedParent}}" Visibility="{Binding Path=(controls:InfoElement.Necessary),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}"/>
            </StackPanel>
            <Border x:Name="border" Grid.Column="1" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True"/>
            <TextBlock VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="8,7,8,8" x:Name="placeholder" Visibility="Collapsed" Grid.Column="1" HorizontalAlignment="Stretch" Style="{StaticResource TextBlockDefaultThiLight}" Text="{Binding Path=(controls:InfoElement.Placeholder),RelativeSource={RelativeSource TemplatedParent}}"/>
            <ScrollViewer Grid.Column="1"  Padding="7,0" Margin="0,1,0,2" x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="controls:PasswordBoxMonitor.PasswordLength" Value="0">
                <Setter Property="Visibility" TargetName="placeholder" Value="Visible"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
                <Setter Property="Opacity" Value="0.4" TargetName="border"/>
                <Setter Property="Opacity" Value="0.4" TargetName="placeholder"/>
                <Setter Property="Opacity" Value="0.4" TargetName="PART_ContentHost"/>
            </Trigger>
            <Trigger Property="IsMouseOver" Value="true" SourceName="PART_ContentHost">
                <Setter Property="BorderBrush" Value="{DynamicResource SecondaryBorderBrush}"/>
            </Trigger>
            <Trigger Property="IsFocused" Value="true">
                <Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style x:Key="PasswordBoxExtendBaseStyle" BasedOn="{StaticResource PasswordBoxBaseStyle}" TargetType="PasswordBox">
        <Setter Property="Height" Value="{x:Static system:Double.NaN}"/>
        <Setter Property="Padding" Value="7,6"/>
        <Setter Property="controls:InfoElement.Symbol" Value="●"/>
        <Setter Property="controls:InfoElement.ContentHeight" Value="30.0"/>
        <Setter Property="controls:PasswordBoxMonitor.IsMonitoring" Value="True"/>
        <Setter Property="Template" Value="{StaticResource PasswordBoxExtendTopTemplate}"/>
        <Style.Triggers>
            <Trigger Property="controls:InfoElement.TitleAlignment" Value="Left">
                <Setter Property="Template" Value="{StaticResource PasswordBoxExtendLeftTemplate}"/>
                <Setter Property="Width" Value="{x:Static system:Double.NaN}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="PasswordBoxPlusInternalStyle" TargetType="PasswordBox">
        <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="AllowDrop" Value="true"/>
        <Setter Property="Height" Value="30"/>
        <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Padding" Value="7,0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="PasswordBox">
                    <Grid>
                        <Border x:Name="border" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True"/>
                        <TextBlock VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="8,7,8,8" x:Name="placeholder" Visibility="Collapsed" HorizontalAlignment="Stretch" Style="{StaticResource TextBlockDefaultThiLight}" Text="{Binding Path=(controls:InfoElement.Placeholder),RelativeSource={RelativeSource TemplatedParent}}"/>
                        <ScrollViewer Padding="{TemplateBinding Padding}" Margin="0,1,0,2" x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="controls:PasswordBoxMonitor.PasswordLength" Value="0">
                            <Setter Property="Visibility" TargetName="placeholder" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Opacity" Value="0.4"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate x:Key="PasswordBoxPlusTopTemplate" TargetType="controls:PasswordBox">
        <ControlTemplate.Resources>
            <Storyboard x:Key="StoryboardShow">
                <ThicknessAnimation Storyboard.TargetName="TextBlockError" Storyboard.TargetProperty="Margin" To="8,0,0,-18" Duration="0:0:.2"/>
            </Storyboard>
            <Storyboard x:Key="StoryboardHidden">
                <ThicknessAnimation Storyboard.TargetName="TextBlockError" Storyboard.TargetProperty="Margin" To="8,0,0,4" Duration="0:0:0"/>
            </Storyboard>
        </ControlTemplate.Resources>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="{Binding Path=(controls:InfoElement.ContentHeight),RelativeSource={RelativeSource TemplatedParent}}"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition Width="Auto" MinWidth="30"/>
            </Grid.ColumnDefinitions>
            <StackPanel Grid.ColumnSpan="2" Visibility="{Binding Path=(controls:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource String2VisibilityConverter}}" Orientation="Horizontal" Margin="7,4">
                <TextBlock Margin="1,0,0,0" Text="{Binding Path=(controls:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent}}"/>
                <ContentPresenter TextElement.Foreground="{DynamicResource DangerBrush}" Margin="4,0,0,0" Content="{Binding Path=(controls:InfoElement.Symbol),RelativeSource={RelativeSource TemplatedParent}}" Visibility="{Binding Path=(controls:InfoElement.Necessary),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}"/>
            </StackPanel>
            <TextBlock Grid.Column="0" Grid.ColumnSpan="2" Text="{TemplateBinding ErrorStr}" Name="TextBlockError" VerticalAlignment="Bottom" Margin="8,0,0,4" Foreground="{DynamicResource DangerBrush}" Grid.Row="1"/>
            <PasswordBox controls:PasswordBoxMonitor.Attach="True" controls:PasswordBoxMonitor.Password="{Binding Text, ElementName=textBox, Mode=TwoWay}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" Foreground="{TemplateBinding Foreground}" BorderThickness="{TemplateBinding BorderThickness}" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" x:Name="PART_PasswordBox" PasswordChar="{TemplateBinding PasswordChar}">
                <PasswordBox.Style>
                    <Style TargetType="{x:Type PasswordBox}" BasedOn="{StaticResource PasswordBoxPlusInternalStyle}">
                        <Setter Property="Visibility" Value="Visible" />
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding IsChecked, ElementName=ButtonEye}" Value="True">
                                <Setter Property="Visibility" Value="Collapsed" />
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </PasswordBox.Style>
            </PasswordBox>
            <TextBox Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" x:Name="textBox">
                <TextBox.Style>
                    <Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource TextBoxExtend}">
                        <Setter Property="Visibility" Value="Visible" />
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding IsChecked, ElementName=ButtonEye}" Value="False">
                                <Setter Property="Visibility" Value="Collapsed" />
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </TextBox.Style>
            </TextBox>
            <StackPanel Name="ButtonStack" Orientation="Horizontal" Grid.Row="1" Grid.Column="1" Margin="0,0,7,0" Visibility="Collapsed">
                <ToggleButton Visibility="Collapsed" Name="ButtonEye" Width="16" Style="{StaticResource ToggleButtonIconTransparent}" Padding="0,6" Margin="5,0" controls:IconSwitchElement.Geometry="{StaticResource Eye}" controls:IconSwitchElement.GeometrySelected="{StaticResource Invisible}" Foreground="{Binding BorderBrush,ElementName=PART_PasswordBox}"/>
                <Button Command="interactivity:ControlCommands.Clear" Visibility="Collapsed" Name="ButtonClear" Width="16" Style="{StaticResource ButtonIcon}" Padding="0,6" controls:IconElement.Geometry="{StaticResource DeleteFillCircleGeometry}" Foreground="{Binding BorderBrush,ElementName=PART_PasswordBox}"/>
            </StackPanel>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="true">
                <Setter Property="BorderBrush" Value="{DynamicResource SecondaryBorderBrush}"/>
            </Trigger>
            <Trigger Property="IsFocused" Value="true" SourceName="PART_PasswordBox">
                <Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}"/>
            </Trigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="true"/>
                    <Condition Property="ShowClearButton" Value="True"/>
                </MultiTrigger.Conditions>
                <Setter Property="Visibility" Value="Visible" TargetName="ButtonStack"/>
                <Setter Property="Visibility" Value="Visible" TargetName="ButtonClear"/>
                <Setter Property="Padding" Value="7,0,30,0" TargetName="PART_PasswordBox"/>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="true"/>
                    <Condition Property="ShowPassword" Value="True"/>
                </MultiTrigger.Conditions>
                <Setter Property="Visibility" Value="Visible" TargetName="ButtonStack"/>
                <Setter Property="Visibility" Value="Visible" TargetName="ButtonEye"/>
                <Setter Property="Padding" Value="7,0,30,0" TargetName="PART_PasswordBox"/>
            </MultiTrigger>
            <Trigger Property="IsError" Value="true">
                <Setter Property="BorderBrush" Value="{DynamicResource DangerBrush}"/>
                <Trigger.EnterActions>
                    <BeginStoryboard Storyboard="{StaticResource StoryboardShow}"/>
                </Trigger.EnterActions>
                <Trigger.ExitActions>
                    <BeginStoryboard Storyboard="{StaticResource StoryboardHidden}"/>
                </Trigger.ExitActions>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="PasswordBoxPlusLeftTemplate" TargetType="controls:PasswordBox">
        <ControlTemplate.Resources>
            <Storyboard x:Key="StoryboardShow">
                <ThicknessAnimation Storyboard.TargetName="TextBlockError" Storyboard.TargetProperty="Margin" To="8,0,0,-18" Duration="0:0:.2"/>
            </Storyboard>
            <Storyboard x:Key="StoryboardHidden">
                <ThicknessAnimation Storyboard.TargetName="TextBlockError" Storyboard.TargetProperty="Margin" To="8,0,0,4" Duration="0:0:0"/>
            </Storyboard>
        </ControlTemplate.Resources>
        <Grid Height="{Binding Path=(controls:InfoElement.ContentHeight),RelativeSource={RelativeSource TemplatedParent}}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="{Binding Path=(controls:InfoElement.TitleWidth),RelativeSource={RelativeSource TemplatedParent}}"/>
                <ColumnDefinition/>
                <ColumnDefinition Width="Auto" MinWidth="30"/>
            </Grid.ColumnDefinitions>
            <StackPanel Grid.Column="0" Visibility="{Binding Path=(controls:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource String2VisibilityConverter}}" Orientation="Horizontal"  Margin="0,7,6,8">
                <TextBlock Margin="1,0,0,0" Text="{Binding Path=(controls:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent}}"/>
                <ContentPresenter TextElement.Foreground="{DynamicResource DangerBrush}" Margin="4,0,0,0" Content="{Binding Path=(controls:InfoElement.Symbol),RelativeSource={RelativeSource TemplatedParent}}" Visibility="{Binding Path=(controls:InfoElement.Necessary),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}"/>
            </StackPanel>
            <TextBlock Grid.ColumnSpan="2" Text="{TemplateBinding ErrorStr}" Name="TextBlockError" VerticalAlignment="Bottom" Margin="8,0,0,4" Foreground="{DynamicResource DangerBrush}" Grid.Column="1"/>
            <PasswordBox controls:PasswordBoxMonitor.Attach="True" controls:PasswordBoxMonitor.Password="{Binding Text, ElementName=textBox, Mode=TwoWay}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" Foreground="{TemplateBinding Foreground}" BorderThickness="{TemplateBinding BorderThickness}" Grid.Column="1" Grid.ColumnSpan="2" x:Name="PART_PasswordBox" PasswordChar="{TemplateBinding PasswordChar}" >
                <PasswordBox.Style>
                    <Style TargetType="{x:Type PasswordBox}" BasedOn="{StaticResource PasswordBoxPlusInternalStyle}">
                        <Setter Property="Visibility" Value="Visible" />
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding IsChecked, ElementName=ButtonEye}" Value="True">
                                <Setter Property="Visibility" Value="Collapsed" />
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </PasswordBox.Style>
            </PasswordBox>
            <TextBox Grid.Column="1" Grid.ColumnSpan="2" x:Name="textBox">
                <TextBox.Style>
                    <Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource TextBoxExtend}">
                        <Setter Property="Visibility" Value="Visible" />
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding IsChecked, ElementName=ButtonEye}" Value="False">
                                <Setter Property="Visibility" Value="Collapsed" />
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </TextBox.Style>
            </TextBox>
            <StackPanel Margin="0,0,7,0"  Grid.Column="2" Orientation="Horizontal" Visibility="Collapsed" Name="ButtonStack">
                <ToggleButton Visibility="Collapsed" Margin="5,0" Name="ButtonEye" Width="16" Style="{StaticResource ToggleButtonIconTransparent}" Padding="0,6" controls:IconSwitchElement.Geometry="{StaticResource Eye}" controls:IconSwitchElement.GeometrySelected="{StaticResource Invisible}" Foreground="{Binding BorderBrush,ElementName=PART_PasswordBox}"/>
                <Button Command="interactivity:ControlCommands.Clear" Visibility="Collapsed" Name="ButtonClear" Width="16" Style="{StaticResource ButtonIcon}" Padding="0,6" controls:IconElement.Geometry="{StaticResource DeleteFillCircleGeometry}" Foreground="{Binding BorderBrush,ElementName=PART_PasswordBox}"/>
            </StackPanel>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="true">
                <Setter Property="BorderBrush" Value="{DynamicResource SecondaryBorderBrush}"/>
            </Trigger>
            <Trigger Property="IsFocused" Value="true" SourceName="PART_PasswordBox">
                <Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}"/>
            </Trigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="true"/>
                    <Condition Property="ShowClearButton" Value="True"/>
                </MultiTrigger.Conditions>
                <Setter Property="Visibility" Value="Visible" TargetName="ButtonStack"/>
                <Setter Property="Visibility" Value="Visible" TargetName="ButtonClear"/>
                <Setter Property="Padding" Value="7,0,30,0" TargetName="PART_PasswordBox"/>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="true"/>
                    <Condition Property="ShowPassword" Value="True"/>
                </MultiTrigger.Conditions>
                <Setter Property="Visibility" Value="Visible" TargetName="ButtonStack"/>
                <Setter Property="Visibility" Value="Visible" TargetName="ButtonEye"/>
                <Setter Property="Padding" Value="7,0,30,0" TargetName="PART_PasswordBox"/>
            </MultiTrigger>
            <Trigger Property="IsError" Value="true">
                <Setter Property="BorderBrush" Value="{DynamicResource DangerBrush}"/>
                <Trigger.EnterActions>
                    <BeginStoryboard Storyboard="{StaticResource StoryboardShow}"/>
                </Trigger.EnterActions>
                <Trigger.ExitActions>
                    <BeginStoryboard Storyboard="{StaticResource StoryboardHidden}"/>
                </Trigger.ExitActions>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style x:Key="PasswordBoxPlusBaseStyle" TargetType="controls:PasswordBox">
        <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="controls:BorderElement.CornerRadius" Value="4"/>
        <Setter Property="PasswordChar" Value="●"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="AllowDrop" Value="true"/>
        <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Height" Value="{x:Static system:Double.NaN}"/>
        <Setter Property="Padding" Value="7,6"/>
        <Setter Property="controls:InfoElement.Symbol" Value="●"/>
        <Setter Property="controls:InfoElement.ContentHeight" Value="30.0"/>
        <Setter Property="controls:PasswordBoxMonitor.IsMonitoring" Value="True"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Template" Value="{StaticResource PasswordBoxPlusTopTemplate}"/>
        <Style.Triggers>
            <Trigger Property="controls:InfoElement.TitleAlignment" Value="Left">
                <Setter Property="Template" Value="{StaticResource PasswordBoxPlusLeftTemplate}"/>
                <Setter Property="Width" Value="{x:Static system:Double.NaN}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

</ResourceDictionary>