<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
                    xmlns:Converters="clr-namespace:Vulnerator.View.Converter"
                    xmlns:GridExtra="clr-namespace:SourceChord.GridExtra;assembly=GridExtra.Wpf"
                    xmlns:IconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
                    xmlns:local="clr-namespace:Vulnerator.View.Styles"
                    xmlns:po="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
                    xmlns:vh="clr-namespace:Vulnerator.View.ViewHelper"
                    xmlns:vm="clr-namespace:Vulnerator.ViewModel">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/Vulnerator;component/View/Styles/Storyboard.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Shared.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <Converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
    <Converters:RemainingCharactersConverter x:Key="RemainingCharactersConverter" />
    <Converters:IsNullConverter x:Key="IsNullConverter" />

    <Style x:Key="TrimmingTextboxStyle"
           BasedOn="{StaticResource MetroTextBox}"
           TargetType="TextBox">
        <Style.Triggers>
            <DataTrigger Binding="{Binding IsKeyboardFocused, RelativeSource={RelativeSource Self}}"
                         Value="False">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="TextBox">
                            <TextBlock VerticalAlignment="Center"
                                       Background="Transparent"
                                       Text="{TemplateBinding Text}"
                                       TextTrimming="CharacterEllipsis" />
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="VerticalContentAlignment" Value="Center" />
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="ErrorTextBox"
           BasedOn="{StaticResource MetroTextBox}"
           TargetType="{x:Type TextBox}">
        <Setter Property="Background" Value="LightPink" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Foreground" Value="DarkRed" />
        <Setter Property="Padding" Value="10" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBox}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="enterGotFocus">
                            <DoubleAnimation Storyboard.TargetName="PART_Message"
                                             Storyboard.TargetProperty="Opacity"
                                             To=".2"
                                             Duration="0:0:0.2" />
                        </Storyboard>
                        <Storyboard x:Key="exitGotFocus">
                            <DoubleAnimation Storyboard.TargetName="PART_Message"
                                             Storyboard.TargetProperty="Opacity"
                                             Duration="0:0:0.2" />
                        </Storyboard>

                        <Storyboard x:Key="enterHasText">
                            <DoubleAnimation Storyboard.TargetName="PART_Message"
                                             Storyboard.TargetProperty="Opacity"
                                             From=".2"
                                             To="0"
                                             Duration="0:0:0.2" />
                        </Storyboard>
                        <Storyboard x:Key="exitHasText">
                            <DoubleAnimation Storyboard.TargetName="PART_Message"
                                             Storyboard.TargetProperty="Opacity"
                                             Duration="0:0:0.2" />
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <Grid>
                        <AdornerDecorator x:Name="PART_WaitingForDataEffectAdornerDecorator"
                                          Visibility="Collapsed">
                            <AdornerDecorator.CacheMode>
                                <BitmapCache EnableClearType="True"
                                             SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                            </AdornerDecorator.CacheMode>
                            <Border x:Name="PART_WaitingForDataEffectGrid"
                                    Background="{TemplateBinding Background}"
                                    BorderBrush="Transparent"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                        </AdornerDecorator>
                        <Border x:Name="Base"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="3"
                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                        <Grid x:Name="PART_InnerGrid"
                              Margin="2">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition x:Name="TextColumn"
                                                  Width="*" />
                                <ColumnDefinition x:Name="ButtonColumn"
                                                  Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition x:Name="ButtonRow"
                                               Height="*" />
                            </Grid.RowDefinitions>
                            <ContentControl x:Name="PART_FloatingMessageContainer"
                                            Grid.Row="0"
                                            Grid.Column="0"
                                            Grid.ColumnSpan="2"
                                            Style="{DynamicResource FloatingMessageContainerStyle}">
                                <TextBlock x:Name="PART_FloatingMessage"
                                           HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                           VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                           Foreground="{TemplateBinding Foreground}"
                                           Style="{DynamicResource MetroAutoCollapsingTextBlock}"
                                           Text="{TemplateBinding Controls:TextBoxHelper.Watermark}" />
                            </ContentControl>
                            <Button x:Name="PART_ClearText"
                                    Grid.Row="0"
                                    Grid.RowSpan="2"
                                    Grid.Column="1"
                                    Width="{TemplateBinding Controls:TextBoxHelper.ButtonWidth}"
                                    Controls:TextBoxHelper.IsClearTextButtonBehaviorEnabled="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:TextBoxHelper.ClearTextButton), Mode=OneWay}"
                                    Content="{TemplateBinding Controls:TextBoxHelper.ButtonContent}"
                                    ContentTemplate="{TemplateBinding Controls:TextBoxHelper.ButtonContentTemplate}"
                                    Focusable="False"
                                    FontFamily="{TemplateBinding Controls:TextBoxHelper.ButtonFontFamily}"
                                    FontSize="{TemplateBinding Controls:TextBoxHelper.ButtonFontSize}"
                                    Foreground="{TemplateBinding Foreground}"
                                    IsTabStop="False"
                                    Style="{DynamicResource ChromelessButtonStyle}"
                                    Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:TextBoxHelper.ClearTextButton), Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}" />
                            <ScrollViewer x:Name="PART_ContentHost"
                                          Grid.Row="1"
                                          Grid.Column="0"
                                          Margin="2"
                                          VerticalAlignment="Stretch"
                                          Background="{x:Null}"
                                          BorderThickness="0"
                                          IsTabStop="False" />
                            <TextBlock x:Name="PART_Message"
                                       Grid.Row="1"
                                       Grid.Column="0"
                                       Margin="6,2,6,2"
                                       Padding="{TemplateBinding Padding}"
                                       HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                       VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                       Foreground="{TemplateBinding Foreground}"
                                       IsHitTestVisible="False"
                                       Opacity="0.6"
                                       Text="{TemplateBinding Controls:TextBoxHelper.Watermark}"
                                       Visibility="Collapsed" />
                        </Grid>
                        <Border x:Name="DisabledVisualElement"
                                Background="{DynamicResource ControlsDisabledBrush}"
                                BorderBrush="{DynamicResource ControlsDisabledBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                IsHitTestVisible="False"
                                Opacity="0"
                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:ControlsHelper.DisabledVisualElementVisibility), Mode=OneWay}" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=(Controls:TextBoxHelper.ButtonsAlignment)}"
                                     Value="Left">
                            <Setter TargetName="ButtonColumn" Property="Width" Value="*" />
                            <Setter TargetName="PART_ClearText" Property="Grid.Column" Value="0" />
                            <Setter TargetName="PART_ContentHost" Property="Grid.Column" Value="1" />
                            <Setter TargetName="PART_Message" Property="Grid.Column" Value="1" />
                            <Setter TargetName="TextColumn" Property="Width" Value="Auto" />
                        </DataTrigger>

                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Text}"
                                     Value="">
                            <Setter TargetName="PART_Message" Property="Visibility" Value="Visible" />
                        </DataTrigger>

                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding Path=IsVisible, RelativeSource={RelativeSource Self}}" Value="True" />
                                <Condition Binding="{Binding Path=(Controls:TextBoxHelper.UseFloatingWatermark), RelativeSource={RelativeSource Self}}" Value="True" />
                                <Condition Binding="{Binding Path=(Controls:TextBoxHelper.HasText), RelativeSource={RelativeSource Self}}" Value="True" />
                            </MultiDataTrigger.Conditions>
                            <MultiDataTrigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource ShowFloatingMessageStoryboard}" />
                            </MultiDataTrigger.EnterActions>
                            <MultiDataTrigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource HideFloatingMessageStoryboard}" />
                            </MultiDataTrigger.ExitActions>
                        </MultiDataTrigger>

                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(Controls:TextBoxHelper.ButtonsAlignment)}" Value="Right" />
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(Controls:TextBoxHelper.ClearTextButton)}" Value="False" />
                            </MultiDataTrigger.Conditions>
                            <Setter TargetName="PART_ContentHost" Property="Grid.ColumnSpan" Value="2" />
                            <Setter TargetName="PART_Message" Property="Grid.ColumnSpan" Value="2" />
                        </MultiDataTrigger>

                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="Base" Property="BorderBrush" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:ControlsHelper.MouseOverBorderBrush)}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="DisabledVisualElement" Property="Opacity" Value="0.6" />
                        </Trigger>
                        <Trigger Property="IsReadOnly" Value="True">
                            <Setter TargetName="PART_ClearText" Property="IsEnabled" Value="False" />
                        </Trigger>
                        <Trigger Property="IsFocused" Value="True">
                            <Setter TargetName="Base" Property="BorderBrush" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:ControlsHelper.FocusBorderBrush)}" />
                            <Setter TargetName="PART_FloatingMessage" Property="Foreground" Value="{DynamicResource AccentColorBrush}" />
                            <Setter TargetName="PART_FloatingMessage" Property="Opacity" Value="1" />
                        </Trigger>
                        <Trigger SourceName="PART_ClearText" Property="IsMouseOver" Value="True">
                            <Setter TargetName="PART_ClearText" Property="Background" Value="{DynamicResource GrayBrush8}" />
                            <Setter TargetName="PART_ClearText" Property="Foreground" Value="{DynamicResource AccentColorBrush}" />
                        </Trigger>
                        <Trigger SourceName="PART_ClearText" Property="IsPressed" Value="True">
                            <Setter TargetName="PART_ClearText" Property="Background" Value="{DynamicResource BlackBrush}" />
                            <Setter TargetName="PART_ClearText" Property="Foreground" Value="{DynamicResource WhiteBrush}" />
                        </Trigger>

                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Controls:TextBoxHelper.HasText" Value="False" />
                                <Condition Property="IsFocused" Value="True" />
                            </MultiTrigger.Conditions>
                            <MultiTrigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource enterGotFocus}" />
                            </MultiTrigger.EnterActions>
                            <MultiTrigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource exitGotFocus}" />
                            </MultiTrigger.ExitActions>
                        </MultiTrigger>

                        <Trigger Property="Controls:TextBoxHelper.HasText" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource enterHasText}" />
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource exitHasText}" />
                            </Trigger.ExitActions>
                        </Trigger>

                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsVisible" Value="True" />
                                <Condition Property="Controls:TextBoxHelper.IsWaitingForData" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="PART_WaitingForDataEffectAdornerDecorator" Property="Visibility" Value="Visible" />
                            <Setter TargetName="PART_WaitingForDataEffectGrid" Property="Effect" Value="{DynamicResource WaitingForDataEffect}" />
                            <MultiTrigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource WaitingForDataStoryboard}" />
                            </MultiTrigger.EnterActions>
                        </MultiTrigger>
                        <Trigger Property="Controls:TextBoxHelper.IsWaitingForData" Value="False">
                            <Setter TargetName="PART_WaitingForDataEffectAdornerDecorator" Property="Visibility" Value="Collapsed" />
                            <Setter TargetName="PART_WaitingForDataEffectGrid" Property="Effect" Value="{x:Null}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="SuccessTextBox"
           BasedOn="{StaticResource ErrorTextBox}"
           TargetType="{x:Type TextBox}">
        <Setter Property="Background" Value="#ccffcc" />
        <Setter Property="Foreground" Value="DarkGreen" />
    </Style>

    <Style x:Key="HeaderedTextBoxStyle"
           TargetType="{x:Type TextBox}">
        <Setter Property="Background" Value="{DynamicResource ControlBackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{DynamicResource TextBoxBorderBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="CaretBrush" Value="{DynamicResource BlackBrush}" />
        <Setter Property="ContextMenu" Value="{DynamicResource TextBoxMetroContextMenu}" />
        <Setter Property="Controls:ControlsHelper.FocusBorderBrush" Value="{DynamicResource TextBoxFocusBorderBrush}" />
        <Setter Property="Controls:ControlsHelper.MouseOverBorderBrush" Value="{DynamicResource TextBoxMouseOverBorderBrush}" />
        <Setter Property="Controls:TextBoxHelper.ButtonFontSize" Value="{DynamicResource ClearTextButtonFontSize}" />
        <Setter Property="Controls:TextBoxHelper.ButtonWidth" Value="22" />
        <Setter Property="Controls:TextBoxHelper.IsMonitoring" Value="True" />
        <Setter Property="Controls:TextBoxHelper.IsSpellCheckContextMenuEnabled" Value="{Binding RelativeSource={RelativeSource Self}, Path=(SpellCheck.IsEnabled)}" />
        <Setter Property="Controls:TextBoxHelper.UseFloatingWatermark" Value="True" />
        <Setter Property="Controls:TextBoxHelper.WatermarkWrapping" Value="{Binding RelativeSource={RelativeSource Self}, Path=TextWrapping, Mode=OneWay}" />
        <Setter Property="FontFamily" Value="{DynamicResource ContentFontFamily}" />
        <Setter Property="FontSize" Value="{DynamicResource ContentFontSize}" />
        <Setter Property="Foreground" Value="{DynamicResource TextBrush}" />
        <Setter Property="MinHeight" Value="26" />
        <Setter Property="Padding" Value="1" />
        <Setter Property="SelectionBrush" Value="{DynamicResource HighlightBrush}" />
        <!--  change SnapsToDevicePixels to True to view a better border and validation error  -->
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBox}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="enterGotFocus">
                            <DoubleAnimation Storyboard.TargetName="PART_Message"
                                             Storyboard.TargetProperty="Opacity"
                                             To=".2"
                                             Duration="0:0:0.2" />
                        </Storyboard>
                        <Storyboard x:Key="exitGotFocus">
                            <DoubleAnimation Storyboard.TargetName="PART_Message"
                                             Storyboard.TargetProperty="Opacity"
                                             Duration="0:0:0.2" />
                        </Storyboard>

                        <Storyboard x:Key="enterHasText">
                            <DoubleAnimation Storyboard.TargetName="PART_Message"
                                             Storyboard.TargetProperty="Opacity"
                                             From=".2"
                                             To="0"
                                             Duration="0:0:0.2" />
                        </Storyboard>
                        <Storyboard x:Key="exitHasText">
                            <DoubleAnimation Storyboard.TargetName="PART_Message"
                                             Storyboard.TargetProperty="Opacity"
                                             Duration="0:0:0.2" />
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Border x:Name="DisabledVisualElement"
                                Grid.RowSpan="2"
                                Background="{DynamicResource ControlsDisabledBrush}"
                                BorderBrush="{DynamicResource ControlsDisabledBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                IsHitTestVisible="False"
                                Opacity="0"
                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:ControlsHelper.DisabledVisualElementVisibility), Mode=OneWay}" />
                        <ContentControl x:Name="PART_FloatingMessageContainer"
                                        Grid.Row="0"
                                        Width="{TemplateBinding Width}"
                                        Margin="0"
                                        HorizontalAlignment="Stretch"
                                        vh:DependencyProperties.FloatingWatermarkForeground="{TemplateBinding vh:DependencyProperties.FloatingWatermarkForeground}"
                                        Style="{DynamicResource FloatingMessageContainerStyle}"
                                        Visibility="Hidden">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>
                                <TextBlock x:Name="PART_FloatingMessage"
                                           HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                           VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                           Foreground="{TemplateBinding vh:DependencyProperties.FloatingWatermarkForeground}"
                                           Opacity="1"
                                           Style="{DynamicResource MetroAutoCollapsingTextBlock}"
                                           Text="{TemplateBinding vh:DependencyProperties.FloatingWatermark}"
                                           TextAlignment="{TemplateBinding Controls:TextBoxHelper.WatermarkAlignment}"
                                           TextTrimming="{TemplateBinding Controls:TextBoxHelper.WatermarkTrimming}">
                                    <TextBlock.RenderTransform>
                                        <TranslateTransform x:Name="FloatingMessageTransform">
                                            <TranslateTransform.Y>
                                                <MultiBinding Converter="{Converters:MathSubtractConverter}">
                                                    <Binding Mode="OneWay"
                                                             ElementName="PART_FloatingMessage"
                                                             Path="ActualHeight" />
                                                    <Binding Mode="OneWay"
                                                             ElementName="PART_FloatingMessageContainer"
                                                             Path="ActualHeight" />
                                                </MultiBinding>
                                            </TranslateTransform.Y>
                                        </TranslateTransform>
                                    </TextBlock.RenderTransform>
                                </TextBlock>
                                <TextBlock x:Name="PART_CharacterCounter"
                                           Grid.Column="2"
                                           HorizontalAlignment="Right"
                                           VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                           Foreground="{TemplateBinding vh:DependencyProperties.FloatingWatermarkForeground}"
                                           Opacity="1"
                                           Style="{DynamicResource MetroAutoCollapsingTextBlock}"
                                           TextAlignment="Right"
                                           Visibility="Hidden">
                                    <TextBlock.Text>
                                        <MultiBinding Converter="{StaticResource RemainingCharactersConverter}">
                                            <Binding Path="MaxLength"
                                                     RelativeSource="{RelativeSource TemplatedParent}" />
                                            <Binding Path="Text.Length"
                                                     RelativeSource="{RelativeSource TemplatedParent}" />
                                        </MultiBinding>
                                    </TextBlock.Text>
                                    <TextBlock.RenderTransform>
                                        <TranslateTransform x:Name="CharacterCountTransform">
                                            <TranslateTransform.Y>
                                                <MultiBinding Converter="{Converters:MathSubtractConverter}">
                                                    <Binding Mode="OneWay"
                                                             ElementName="PART_CharacterCounter"
                                                             Path="ActualHeight" />
                                                    <Binding Mode="OneWay"
                                                             ElementName="PART_CharacterCountContainer"
                                                             Path="ActualHeight" />
                                                </MultiBinding>
                                            </TranslateTransform.Y>
                                        </TranslateTransform>
                                    </TextBlock.RenderTransform>
                                </TextBlock>
                            </Grid>
                        </ContentControl>
                        <AdornerDecorator x:Name="PART_WaitingForDataEffectAdornerDecorator"
                                          Grid.Row="1"
                                          Visibility="Collapsed">
                            <Border x:Name="PART_WaitingForDataEffectGrid"
                                    Background="{TemplateBinding Background}"
                                    BorderBrush="Transparent"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    Effect="{DynamicResource WaitingForDataEffect}"
                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                        </AdornerDecorator>
                        <Border x:Name="Base"
                                Grid.Row="1"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="3"
                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                        <Grid x:Name="PART_InnerGrid"
                              Grid.Row="1"
                              Margin="2">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition x:Name="TextColumn"
                                                  Width="*" />
                                <ColumnDefinition x:Name="ButtonColumn"
                                                  Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition x:Name="ButtonRow"
                                               Height="*" />
                            </Grid.RowDefinitions>
                            <ScrollViewer x:Name="PART_ContentHost"
                                          Grid.Row="1"
                                          Grid.Column="0"
                                          Margin="2"
                                          VerticalAlignment="Stretch"
                                          Background="{x:Null}"
                                          BorderThickness="0"
                                          IsTabStop="False" />
                            <TextBlock x:Name="PART_Message"
                                       Grid.Row="1"
                                       Grid.Column="0"
                                       Margin="6,3,6,3"
                                       Padding="{TemplateBinding Padding}"
                                       HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                       VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                       Foreground="{TemplateBinding Foreground}"
                                       Style="{DynamicResource MahApps.Metro.Styles.MetroWatermarkTextBlock}"
                                       Text="{TemplateBinding Controls:TextBoxHelper.Watermark}"
                                       TextAlignment="{TemplateBinding Controls:TextBoxHelper.WatermarkAlignment}"
                                       TextTrimming="{TemplateBinding Controls:TextBoxHelper.WatermarkTrimming}"
                                       TextWrapping="{TemplateBinding Controls:TextBoxHelper.WatermarkWrapping}"
                                       Visibility="Collapsed" />
                            <Button x:Name="PART_ClearText"
                                    Grid.Row="1"
                                    Grid.Column="1"
                                    Width="{TemplateBinding Controls:TextBoxHelper.ButtonWidth}"
                                    Controls:TextBoxHelper.IsClearTextButtonBehaviorEnabled="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:TextBoxHelper.ClearTextButton), Mode=OneWay}"
                                    Content="{TemplateBinding Controls:TextBoxHelper.ButtonContent}"
                                    ContentTemplate="{TemplateBinding Controls:TextBoxHelper.ButtonContentTemplate}"
                                    Focusable="False"
                                    FontFamily="{TemplateBinding Controls:TextBoxHelper.ButtonFontFamily}"
                                    FontSize="{TemplateBinding Controls:TextBoxHelper.ButtonFontSize}"
                                    Foreground="{TemplateBinding Foreground}"
                                    IsTabStop="False"
                                    Style="{DynamicResource ChromelessButtonStyle}"
                                    Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:TextBoxHelper.ClearTextButton), Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}" />
                        </Grid>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=(Controls:TextBoxHelper.ButtonsAlignment)}"
                                     Value="Left">
                            <Setter TargetName="ButtonColumn" Property="Width" Value="*" />
                            <Setter TargetName="PART_ClearText" Property="Grid.Column" Value="0" />
                            <Setter TargetName="PART_ContentHost" Property="Grid.Column" Value="1" />
                            <Setter TargetName="PART_Message" Property="Grid.Column" Value="1" />
                            <Setter TargetName="TextColumn" Property="Width" Value="Auto" />
                        </DataTrigger>

                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Text}"
                                     Value="">
                            <Setter TargetName="PART_Message" Property="Visibility" Value="Visible" />
                        </DataTrigger>

                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding Path=IsVisible, RelativeSource={RelativeSource Self}}" Value="True" />
                                <Condition Binding="{Binding Path=(vh:DependencyProperties.ShowCharacterCount), RelativeSource={RelativeSource Self}}" Value="True" />
                                <Condition Binding="{Binding Path=(Controls:TextBoxHelper.HasText), RelativeSource={RelativeSource Self}}" Value="True" />
                            </MultiDataTrigger.Conditions>
                            <MultiDataTrigger.EnterActions>
                                <BeginStoryboard Storyboard="{DynamicResource ShowCharacterCountStoryboard}" />
                            </MultiDataTrigger.EnterActions>
                            <MultiDataTrigger.ExitActions>
                                <BeginStoryboard Storyboard="{DynamicResource HideCharcterCountStoryboard}" />
                            </MultiDataTrigger.ExitActions>
                        </MultiDataTrigger>

                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding Path=IsVisible, RelativeSource={RelativeSource Self}}" Value="True" />
                                <Condition Binding="{Binding Path=(Controls:TextBoxHelper.UseFloatingWatermark), RelativeSource={RelativeSource Self}}" Value="True" />
                                <Condition Binding="{Binding Path=(Controls:TextBoxHelper.HasText), RelativeSource={RelativeSource Self}}" Value="True" />
                            </MultiDataTrigger.Conditions>
                            <MultiDataTrigger.EnterActions>
                                <BeginStoryboard Storyboard="{DynamicResource CustomShowFloatingMessageStoryboard}" />
                            </MultiDataTrigger.EnterActions>
                            <MultiDataTrigger.ExitActions>
                                <BeginStoryboard Storyboard="{DynamicResource CustomHideFloatingMessageStoryboard}" />
                            </MultiDataTrigger.ExitActions>
                        </MultiDataTrigger>

                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(Controls:TextBoxHelper.ButtonsAlignment)}" Value="Right" />
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(Controls:TextBoxHelper.ClearTextButton)}" Value="False" />
                            </MultiDataTrigger.Conditions>
                            <Setter TargetName="PART_ContentHost" Property="Grid.ColumnSpan" Value="2" />
                            <Setter TargetName="PART_Message" Property="Grid.ColumnSpan" Value="2" />
                        </MultiDataTrigger>

                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="Base" Property="BorderBrush" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:ControlsHelper.MouseOverBorderBrush)}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="DisabledVisualElement" Property="Opacity" Value="0.6" />
                        </Trigger>
                        <Trigger Property="IsReadOnly" Value="True">
                            <Setter TargetName="PART_ClearText" Property="IsEnabled" Value="False" />
                        </Trigger>
                        <Trigger Property="IsFocused" Value="True">
                            <Setter TargetName="Base" Property="BorderBrush" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:ControlsHelper.FocusBorderBrush)}" />
                        </Trigger>
                        <Trigger SourceName="PART_ClearText" Property="IsMouseOver" Value="True">
                            <Setter TargetName="PART_ClearText" Property="Background" Value="{DynamicResource GrayBrush8}" />
                            <Setter TargetName="PART_ClearText" Property="Foreground" Value="{DynamicResource AccentColorBrush}" />
                        </Trigger>
                        <Trigger SourceName="PART_ClearText" Property="IsPressed" Value="True">
                            <Setter TargetName="PART_ClearText" Property="Background" Value="{DynamicResource BlackBrush}" />
                            <Setter TargetName="PART_ClearText" Property="Foreground" Value="{DynamicResource WhiteBrush}" />
                        </Trigger>

                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Controls:TextBoxHelper.HasText" Value="False" />
                                <Condition Property="IsFocused" Value="True" />
                            </MultiTrigger.Conditions>
                            <MultiTrigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource enterGotFocus}" />
                            </MultiTrigger.EnterActions>
                            <MultiTrigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource exitGotFocus}" />
                            </MultiTrigger.ExitActions>
                        </MultiTrigger>

                        <Trigger Property="Controls:TextBoxHelper.HasText" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource enterHasText}" />
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource exitHasText}" />
                            </Trigger.ExitActions>
                        </Trigger>

                        <Trigger Property="Validation.HasError" Value="True">
                            <Setter TargetName="Base" Property="BorderBrush" Value="Red" />
                        </Trigger>

                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsVisible" Value="True" />
                                <Condition Property="Controls:TextBoxHelper.IsWaitingForData" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="PART_WaitingForDataEffectAdornerDecorator" Property="Visibility" Value="Visible" />
                            <MultiTrigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource WaitingForDataStoryboard}" />
                            </MultiTrigger.EnterActions>
                        </MultiTrigger>
                        <Trigger Property="Controls:TextBoxHelper.IsWaitingForData" Value="False">
                            <Setter TargetName="PART_WaitingForDataEffectAdornerDecorator" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Text" Value="{Binding Path=(vh:DependencyProperties.PrimaryValue), RelativeSource={RelativeSource Self}, Mode=TwoWay}" />
        <Setter Property="Validation.ErrorTemplate">
            <Setter.Value>
                <ControlTemplate>
                    <StackPanel>
                        <AdornedElementPlaceholder x:Name="textBox" />
                        <Border Background="Red"
                                BorderBrush="Red"
                                BorderThickness="1,0,1,1">
                            <TextBlock Foreground="White"
                                       Text="{Binding [0].ErrorContent}" />
                        </Border>
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="vh:DependencyProperties.FloatingWatermark" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Controls:TextBoxHelper.Watermark)}" />
        <Setter Property="vh:DependencyProperties.FloatingWatermarkForeground" Value="{Binding RelativeSource={RelativeSource Self}, Path=Foreground}" />
        <Setter Property="vh:DependencyProperties.PrimaryValue" Value="{Binding Path=(vh:DependencyProperties.PrimaryValue), RelativeSource={RelativeSource Self}}" />
        <Setter Property="vh:DependencyProperties.SecondaryValue" Value="{Binding Path=(vh:DependencyProperties.PrimaryValue), RelativeSource={RelativeSource Self}}" />
        <Style.Triggers>
            <DataTrigger Binding="{Binding Path=(vh:DependencyProperties.AlternateValueTrigger), RelativeSource={RelativeSource Self}, Converter={StaticResource IsNullConverter}}"
                         Value="False">
                <Setter Property="Text" Value="{Binding Path=(vh:DependencyProperties.SecondaryValue), RelativeSource={RelativeSource Self}, Mode=TwoWay}" />
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="NonHeaderedTextBoxStyle"
           TargetType="{x:Type TextBox}">
        <Setter Property="Background" Value="{DynamicResource ControlBackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{DynamicResource TextBoxBorderBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="CaretBrush" Value="{DynamicResource BlackBrush}" />
        <Setter Property="ContextMenu" Value="{DynamicResource TextBoxMetroContextMenu}" />
        <Setter Property="Controls:ControlsHelper.FocusBorderBrush" Value="{DynamicResource TextBoxFocusBorderBrush}" />
        <Setter Property="Controls:ControlsHelper.MouseOverBorderBrush" Value="{DynamicResource TextBoxMouseOverBorderBrush}" />
        <Setter Property="Controls:TextBoxHelper.ButtonFontSize" Value="{DynamicResource ClearTextButtonFontSize}" />
        <Setter Property="Controls:TextBoxHelper.ButtonWidth" Value="22" />
        <Setter Property="Controls:TextBoxHelper.IsMonitoring" Value="True" />
        <Setter Property="Controls:TextBoxHelper.IsSpellCheckContextMenuEnabled" Value="{Binding RelativeSource={RelativeSource Self}, Path=(SpellCheck.IsEnabled)}" />
        <Setter Property="Controls:TextBoxHelper.WatermarkWrapping" Value="{Binding RelativeSource={RelativeSource Self}, Path=TextWrapping, Mode=OneWay}" />
        <Setter Property="FontFamily" Value="{DynamicResource ContentFontFamily}" />
        <Setter Property="FontSize" Value="{DynamicResource ContentFontSize}" />
        <Setter Property="Foreground" Value="{DynamicResource TextBrush}" />
        <Setter Property="MinHeight" Value="26" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="SelectionBrush" Value="{DynamicResource HighlightBrush}" />
        <!--  change SnapsToDevicePixels to True to view a better border and validation error  -->
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBox}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="enterGotFocus">
                            <DoubleAnimation Storyboard.TargetName="PART_Message"
                                             Storyboard.TargetProperty="Opacity"
                                             To=".2"
                                             Duration="0:0:0.2" />
                        </Storyboard>
                        <Storyboard x:Key="exitGotFocus">
                            <DoubleAnimation Storyboard.TargetName="PART_Message"
                                             Storyboard.TargetProperty="Opacity"
                                             Duration="0:0:0.2" />
                        </Storyboard>

                        <Storyboard x:Key="enterHasText">
                            <DoubleAnimation Storyboard.TargetName="PART_Message"
                                             Storyboard.TargetProperty="Opacity"
                                             From=".2"
                                             To="0"
                                             Duration="0:0:0.2" />
                        </Storyboard>
                        <Storyboard x:Key="exitHasText">
                            <DoubleAnimation Storyboard.TargetName="PART_Message"
                                             Storyboard.TargetProperty="Opacity"
                                             Duration="0:0:0.2" />
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <Grid>
                        <AdornerDecorator x:Name="PART_WaitingForDataEffectAdornerDecorator"
                                          Visibility="Collapsed">
                            <Border x:Name="PART_WaitingForDataEffectGrid"
                                    Background="{TemplateBinding Background}"
                                    BorderBrush="Transparent"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    Effect="{DynamicResource WaitingForDataEffect}"
                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                        </AdornerDecorator>
                        <Border x:Name="Base"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="3"
                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                        <Grid x:Name="PART_InnerGrid"
                              Margin="2,3,2,3">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition x:Name="TextColumn"
                                                  Width="*" />
                                <ColumnDefinition x:Name="ButtonColumn"
                                                  Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition x:Name="ButtonRow"
                                               Height="*" />
                            </Grid.RowDefinitions>
                            <ContentControl x:Name="PART_FloatingMessageContainer"
                                            Grid.Row="0"
                                            Grid.Column="0"
                                            Style="{DynamicResource FloatingMessageContainerStyle}">
                                <ContentControl.Height>
                                    <MultiBinding Converter="{Converters:MathMultiplyConverter}">
                                        <Binding Mode="OneWay"
                                                 ElementName="PART_FloatingMessage"
                                                 Path="ActualHeight" />
                                        <Binding Mode="OneWay"
                                                 ElementName="PART_FloatingMessageContainer"
                                                 Path="Opacity" />
                                    </MultiBinding>
                                </ContentControl.Height>
                                <TextBlock x:Name="PART_FloatingMessage"
                                           HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                           VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                           Foreground="{TemplateBinding Foreground}"
                                           Style="{DynamicResource MahApps.Styles.TextBlock.AutoCollapsing}"
                                           Text="{TemplateBinding Controls:TextBoxHelper.Watermark}"
                                           TextAlignment="{TemplateBinding Controls:TextBoxHelper.WatermarkAlignment}"
                                           TextTrimming="{TemplateBinding Controls:TextBoxHelper.WatermarkTrimming}">
                                    <TextBlock.RenderTransform>
                                        <TranslateTransform x:Name="FloatingMessageTransform">
                                            <TranslateTransform.Y>
                                                <MultiBinding Converter="{Converters:MathSubtractConverter}">
                                                    <Binding Mode="OneWay"
                                                             ElementName="PART_FloatingMessage"
                                                             Path="ActualHeight" />
                                                    <Binding Mode="OneWay"
                                                             ElementName="PART_FloatingMessageContainer"
                                                             Path="ActualHeight" />
                                                </MultiBinding>
                                            </TranslateTransform.Y>
                                        </TranslateTransform>
                                    </TextBlock.RenderTransform>
                                </TextBlock>
                            </ContentControl>
                            <Button x:Name="PART_ClearText"
                                    Grid.Row="0"
                                    Grid.RowSpan="2"
                                    Grid.Column="1"
                                    Width="{TemplateBinding Controls:TextBoxHelper.ButtonWidth}"
                                    Controls:TextBoxHelper.IsClearTextButtonBehaviorEnabled="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:TextBoxHelper.ClearTextButton), Mode=OneWay}"
                                    Content="{TemplateBinding Controls:TextBoxHelper.ButtonContent}"
                                    ContentTemplate="{TemplateBinding Controls:TextBoxHelper.ButtonContentTemplate}"
                                    Focusable="False"
                                    FontFamily="{TemplateBinding Controls:TextBoxHelper.ButtonFontFamily}"
                                    FontSize="{TemplateBinding Controls:TextBoxHelper.ButtonFontSize}"
                                    Foreground="{TemplateBinding Foreground}"
                                    IsTabStop="False"
                                    Style="{DynamicResource ChromelessButtonStyle}"
                                    Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:TextBoxHelper.ClearTextButton), Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}" />

                            <ScrollViewer x:Name="PART_ContentHost"
                                          Grid.Row="1"
                                          Grid.Column="0"
                                          Margin="2,3,2,3"
                                          VerticalAlignment="Stretch"
                                          Background="{x:Null}"
                                          BorderThickness="0"
                                          IsTabStop="False" />
                            <TextBlock x:Name="PART_Message"
                                       Grid.Row="1"
                                       Grid.Column="0"
                                       Margin="6,3,6,3"
                                       Padding="{TemplateBinding Padding}"
                                       HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                       VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                       Foreground="{TemplateBinding Foreground}"
                                       Style="{DynamicResource MahApps.Metro.Styles.MetroWatermarkTextBlock}"
                                       Text="{TemplateBinding Controls:TextBoxHelper.Watermark}"
                                       TextAlignment="{TemplateBinding Controls:TextBoxHelper.WatermarkAlignment}"
                                       TextTrimming="{TemplateBinding Controls:TextBoxHelper.WatermarkTrimming}"
                                       TextWrapping="{TemplateBinding Controls:TextBoxHelper.WatermarkWrapping}"
                                       Visibility="Collapsed" />
                        </Grid>
                        <Border x:Name="DisabledVisualElement"
                                Background="{DynamicResource MahApps.Brushes.Controls.Disabled}"
                                BorderBrush="{DynamicResource MahApps.Brushes.Controls.Disabled}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                IsHitTestVisible="False"
                                Opacity="0"
                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:ControlsHelper.DisabledVisualElementVisibility), Mode=OneWay}" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=(Controls:TextBoxHelper.ButtonsAlignment)}"
                                     Value="Left">
                            <Setter TargetName="ButtonColumn" Property="Width" Value="*" />
                            <Setter TargetName="PART_ClearText" Property="Grid.Column" Value="0" />
                            <Setter TargetName="PART_ContentHost" Property="Grid.Column" Value="1" />
                            <Setter TargetName="PART_Message" Property="Grid.Column" Value="1" />
                            <Setter TargetName="TextColumn" Property="Width" Value="Auto" />
                        </DataTrigger>

                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Text}"
                                     Value="">
                            <Setter TargetName="PART_Message" Property="Visibility" Value="Visible" />
                        </DataTrigger>

                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding Path=IsVisible, RelativeSource={RelativeSource Self}}" Value="True" />
                                <Condition Binding="{Binding Path=(Controls:TextBoxHelper.UseFloatingWatermark), RelativeSource={RelativeSource Self}}" Value="True" />
                                <Condition Binding="{Binding Path=(Controls:TextBoxHelper.HasText), RelativeSource={RelativeSource Self}}" Value="True" />
                            </MultiDataTrigger.Conditions>
                            <MultiDataTrigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource CustomShowFloatingMessageStoryboard}" />
                            </MultiDataTrigger.EnterActions>
                            <MultiDataTrigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource CustomHideFloatingMessageStoryboard}" />
                            </MultiDataTrigger.ExitActions>
                        </MultiDataTrigger>

                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(Controls:TextBoxHelper.ButtonsAlignment)}" Value="Right" />
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(Controls:TextBoxHelper.ClearTextButton)}" Value="False" />
                            </MultiDataTrigger.Conditions>
                            <Setter TargetName="PART_ContentHost" Property="Grid.ColumnSpan" Value="2" />
                            <Setter TargetName="PART_Message" Property="Grid.ColumnSpan" Value="2" />
                        </MultiDataTrigger>

                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="Base" Property="BorderBrush" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:ControlsHelper.MouseOverBorderBrush)}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="DisabledVisualElement" Property="Opacity" Value="0.6" />
                        </Trigger>
                        <Trigger Property="IsReadOnly" Value="True">
                            <Setter TargetName="PART_ClearText" Property="IsEnabled" Value="False" />
                        </Trigger>
                        <Trigger Property="IsFocused" Value="True">
                            <Setter TargetName="Base" Property="BorderBrush" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:ControlsHelper.FocusBorderBrush)}" />
                            <Setter TargetName="PART_FloatingMessage" Property="Foreground" Value="{DynamicResource AccentColorBrush}" />
                            <Setter TargetName="PART_FloatingMessage" Property="Opacity" Value="1" />
                        </Trigger>
                        <Trigger SourceName="PART_ClearText" Property="IsMouseOver" Value="True">
                            <Setter TargetName="PART_ClearText" Property="Background" Value="{DynamicResource GrayBrush8}" />
                            <Setter TargetName="PART_ClearText" Property="Foreground" Value="{DynamicResource AccentColorBrush}" />
                        </Trigger>
                        <Trigger SourceName="PART_ClearText" Property="IsPressed" Value="True">
                            <Setter TargetName="PART_ClearText" Property="Background" Value="{DynamicResource BlackBrush}" />
                            <Setter TargetName="PART_ClearText" Property="Foreground" Value="{DynamicResource WhiteBrush}" />
                        </Trigger>

                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Controls:TextBoxHelper.HasText" Value="False" />
                                <Condition Property="IsFocused" Value="True" />
                            </MultiTrigger.Conditions>
                            <MultiTrigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource enterGotFocus}" />
                            </MultiTrigger.EnterActions>
                            <MultiTrigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource exitGotFocus}" />
                            </MultiTrigger.ExitActions>
                        </MultiTrigger>

                        <Trigger Property="Controls:TextBoxHelper.HasText" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource enterHasText}" />
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource exitHasText}" />
                            </Trigger.ExitActions>
                        </Trigger>

                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsVisible" Value="True" />
                                <Condition Property="Controls:TextBoxHelper.IsWaitingForData" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="PART_WaitingForDataEffectAdornerDecorator" Property="Visibility" Value="Visible" />
                            <MultiTrigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource WaitingForDataStoryboard}" />
                            </MultiTrigger.EnterActions>
                        </MultiTrigger>
                        <Trigger Property="Controls:TextBoxHelper.IsWaitingForData" Value="False">
                            <Setter TargetName="PART_WaitingForDataEffectAdornerDecorator" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Validation.ErrorTemplate" Value="{DynamicResource ValidationError}" />
    </Style>

    <Style x:Key="ResponsiveGridReportingTextBoxStyle"
           BasedOn="{StaticResource HeaderedTextBoxStyle}"
           TargetType="{x:Type TextBox}">
        <Setter Property="GridExtra:ResponsiveGrid.MD" Value="4" />
        <Setter Property="GridExtra:ResponsiveGrid.XS" Value="12" />
    </Style>

</ResourceDictionary>