<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:ui="clr-namespace:GitHub.UI;assembly=GitHub.UI"
                    xmlns:vs="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.14.0"
                    xmlns:shell="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.14.0">
    
    <Style x:Key="GitHubVsPromptTextBox" TargetType="{x:Type ui:PromptTextBox}">
        <Setter Property="Background" Value="{DynamicResource {x:Static vs:CommonControlsColors.TextBoxBackgroundBrushKey}}"/>
        <Setter Property="Foreground" Value="{DynamicResource {x:Static vs:CommonControlsColors.TextBoxTextBrushKey}}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource {x:Static vs:CommonControlsColors.TextBoxBorderBrushKey}}"/>
        <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="5"/>
        <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
        <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ui:PromptTextBox}">
                    <Grid>
                        <Border x:Name="Bd" CornerRadius="0" ClipToBounds="True" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                            <Border CornerRadius="0" BorderBrush="Black" BorderThickness="0,1,0,0" Margin="0,-2,0,0" Opacity="0.4">
                                <Border.Effect>
                                    <DropShadowEffect Direction="270" ShadowDepth="0" BlurRadius="4" Opacity="1" />
                                </Border.Effect>
                            </Border>
                        </Border>

                        <Grid>
                            <ScrollViewer x:Name="PART_ContentHost" Padding="{TemplateBinding Padding}" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" VerticalAlignment="Top" Margin="0"/>
                            <Label x:Name="PromptLabel" HorizontalAlignment="Left"
                                 Foreground="{DynamicResource {x:Static shell:VsBrushes.GrayTextKey}}"
                                 FontSize="{TemplateBinding FontSize}" Padding="{TemplateBinding Padding}" Opacity="0"
                                 Target="{Binding ElementName=Bd}"
                                 SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Focusable="False" IsHitTestVisible="False"
                                 VerticalAlignment="Top">
                                <TextBlock Text="{TemplateBinding PromptText}" Margin="2,0,0,0" TextTrimming="CharacterEllipsis" />
                            </Label>
                        </Grid>
                    </Grid>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Opacity" Value="0.5" />
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="BorderBrush" TargetName="Bd" Value="{DynamicResource GitHubVsBrandedUIBorder}" />
                        </Trigger>
                        <Trigger Property="IsKeyboardFocusWithin" Value="True">
                            <Setter Property="BorderBrush" TargetName="Bd" Value="{DynamicResource {x:Static vs:CommonControlsColors.TextBoxBorderFocusedBrushKey}}" />
                        </Trigger>
                        <DataTrigger Binding="{Binding Text.Length, RelativeSource={RelativeSource Self}}" Value="0">
                            <Setter Property="Opacity" TargetName="PromptLabel" Value="0.7" />
                            <Setter Property="Foreground" Value="Transparent" />
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="FlatReadOnlyTextBox" TargetType="TextBox">
        <Setter Property="IsReadOnly" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBox}">
                    <Grid>
                        <ScrollViewer Margin="0" x:Name="PART_ContentHost" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="TeamExplorerPromptTextBox" TargetType="{x:Type ui:PromptTextBox}">
        <Setter Property="TextBoxBase.CaretBrush" Value="{DynamicResource GitHubVsWindowText}" />
        <Setter Property="Foreground" Value="{DynamicResource GitHubVsWindowText}" />
        <Setter Property="Background" Value="{DynamicResource TFTextBoxBrushKey}" />
        <Setter Property="BorderBrush" Value="{DynamicResource TFTextBoxBorderBrushKey}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ui:PromptTextBox}">
                    <Border Name="Border"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="1"
                            Background="{TemplateBinding Background}"
                            SnapsToDevicePixels="True">
                        <Grid>
                            <Border x:Name="PromptBorder"
                                    Background="{DynamicResource WorkItemInvalidControlBackground}"
                                    Focusable="False"
                                    Padding="2 0"
                                    IsHitTestVisible="False"
                                    Visibility="Collapsed">
                                <TextBlock HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                           Focusable="False"
                                           Foreground="{DynamicResource TFTextBoxHintTextBrushKey}"
                                           FontSize="{TemplateBinding FontSize}"
                                           IsHitTestVisible="False"
                                           Padding="{TemplateBinding Padding}"
                                           SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                           Text="{TemplateBinding PromptText}"
                                           TextTrimming="CharacterEllipsis"
                                           VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            </Border>
                            <ScrollViewer x:Name="PART_ContentHost"
                                          Padding="{TemplateBinding Padding}"
                                          Focusable="false"
                                          HorizontalScrollBarVisibility="Hidden"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                          VerticalScrollBarVisibility="Hidden"
                                          Margin="0"/>
                        </Grid>
                    </Border>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Opacity" Value="0.5" />
                        </Trigger>
                        <DataTrigger Binding="{Binding Text.Length, RelativeSource={RelativeSource Self}}" Value="0">
                            <Setter Property="BorderBrush" TargetName="Border" Value="{DynamicResource TFRequiredTextBoxBorderBrushKey}" />
                            <Setter Property="Foreground" Value="Transparent" />
                            <Setter Property="Visibility" TargetName="PromptBorder" Value="Visible" />
                        </DataTrigger>
                    </ControlTemplate.Triggers>

                </ControlTemplate>

            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type ui:PromptTextBox}" BasedOn="{StaticResource GitHubVsPromptTextBox}" />
    <Style TargetType="{x:Type ui:SecurePasswordBox}" BasedOn="{StaticResource GitHubVsPromptTextBox}" />

</ResourceDictionary>