<UserControl
    x:Class="Wabbajack.FilePicker"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:icon="http://metro.mahapps.com/winfx/xaml/iconpacks"
    xmlns:local="clr-namespace:Wabbajack"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    d:DesignHeight="35"
    d:DesignWidth="400"
    BorderBrush="{StaticResource DarkBackgroundBrush}"
    mc:Ignorable="d">
    <Grid ClipToBounds="True">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="36" />
        </Grid.ColumnDefinitions>
        <Border
            x:Name="BackgroundCornerFillIn"
            Grid.Column="0"
            Grid.ColumnSpan="2"
            Margin="0,0,5,0"
            Background="{StaticResource TextBoxBackground}"
            CornerRadius="3" />
        <TextBox
            Grid.Column="0"
            Margin="5,1,-2,1"
            VerticalContentAlignment="Center"
            Background="{StaticResource DarkBackgroundBrush}"
            Text="{Binding TargetPath, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
            Visibility="{Binding ShowTextBoxInput}" />
        <Grid Grid.Column="1" HorizontalAlignment="Right">
            <Border
                Margin="3,1,0,1"
                HorizontalAlignment="Right"
                Background="{StaticResource WarningBrush}"
                CornerRadius="3"
                ToolTip="{Binding ErrorTooltip}">
                <Border.Style>
                    <Style TargetType="Border">
                        <Setter Property="Width" Value="25" />
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding InError}" Value="True">
                                <DataTrigger.EnterActions>
                                    <BeginStoryboard>
                                        <Storyboard>
                                            <DoubleAnimation
                                                Storyboard.TargetProperty="Width"
                                                To="33"
                                                Duration="0:0:0.1">
                                                <DoubleAnimation.EasingFunction>
                                                    <ExponentialEase EasingMode="EaseOut" />
                                                </DoubleAnimation.EasingFunction>
                                            </DoubleAnimation>
                                        </Storyboard>
                                    </BeginStoryboard>
                                </DataTrigger.EnterActions>
                                <DataTrigger.ExitActions>
                                    <BeginStoryboard>
                                        <Storyboard>
                                            <DoubleAnimation
                                                Storyboard.TargetProperty="Width"
                                                To="25"
                                                Duration="0:0:0.1">
                                                <DoubleAnimation.EasingFunction>
                                                    <ExponentialEase EasingMode="EaseOut" />
                                                </DoubleAnimation.EasingFunction>
                                            </DoubleAnimation>
                                        </Storyboard>
                                    </BeginStoryboard>
                                </DataTrigger.ExitActions>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </Border.Style>
            </Border>
            <Border
                Width="30"
                HorizontalAlignment="Left"
                Background="{StaticResource TextBoxBackground}"
                CornerRadius="3">
                <Button Command="{Binding SetTargetPathCommand}" ToolTip="Set target path">
                    <icon:PackIconMaterial
                        Width="16"
                        Height="12"
                        Margin="4"
                        Kind="DotsHorizontal" />
                </Button>
                <Border.Effect>
                    <DropShadowEffect
                        BlurRadius="3"
                        Direction="0"
                        Opacity="0.5"
                        ShadowDepth="2" />
                </Border.Effect>
            </Border>
        </Grid>
    </Grid>
</UserControl>
