<UserControl
    x:Class="PicView.Views.UserControls.CustomTextBox"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <TextBox
        x:Name="InnerTextBox"
        VerticalAlignment="Center"
        AcceptsReturn="True"
        AcceptsTab="False"
        AutoWordSelection="True"
        Background="{x:Null}"
        CaretBrush="{StaticResource MainColorBrush}"
        ContextMenu="{x:Null}"
        FontFamily="/PicView;component/Themes/Resources/fonts/#Roboto Bold"
        FontSize="12"
        Foreground="{StaticResource MainColorBrush}"
        IsUndoEnabled="True"
        OverridesDefaultStyle="True"
        SelectionBrush="{DynamicResource ChosenColorBrush}"
        SelectionTextBrush="{StaticResource MainColorBrush}"
        Text="{StaticResource Loading}"
        TextAlignment="Center"
        IsTabStop="False"
        UndoLimit="200">
        <TextBox.Style>
            <Style TargetType="TextBox">
                <Setter Property="FocusVisualStyle" Value="{x:Null}" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type TextBox}">
                            <Border
                                x:Name="bg"
                                Padding="5,5,5,5"
                                BorderBrush="{DynamicResource ChosenColorBrush}"
                                BorderThickness="1">
                                <ScrollViewer x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                            </Border>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsFocused" Value="True">
                                    <Setter TargetName="bg" Property="BorderBrush" Value="{StaticResource ResourceKey=ChosenColorBrush}" />
                                    <Setter TargetName="bg" Property="BorderThickness" Value="1" />
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding IsKeyboardFocused, RelativeSource={RelativeSource Self}}" Value="false">
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="TextBox">
                                    <TextBlock Text="{TemplateBinding Text}" TextTrimming="CharacterEllipsis" />
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </DataTrigger>
                </Style.Triggers>
            </Style>
        </TextBox.Style>
    </TextBox>
</UserControl>