<!--
    This Source Code Form is subject to the terms of the MIT License.
    If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
    Copyright (C) Leszek Pomianowski and WPF UI Contributors.
    All Rights Reserved.
-->

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >

    <Thickness x:Key="RichTextBoxAccentBorderThemeThickness">0,0,0,1</Thickness>

    <Style x:Key="DefaultRichTextBoxStyle" TargetType="{x:Type RichTextBox}">
        <Setter Property="Foreground" Value="{DynamicResource TextControlForeground}" />
        <Setter Property="CaretBrush" Value="{DynamicResource TextControlForeground}" />
        <Setter Property="Background" Value="{DynamicResource TextControlBackground}" />
        <Setter Property="BorderBrush" Value="{DynamicResource TextControlElevationBorderBrush}" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="VerticalScrollBarVisibility" Value="Auto" />
        <Setter Property="HorizontalScrollBarVisibility" Value="Disabled" />
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="VerticalAlignment" Value="Stretch" />
        <Setter Property="MinHeight" Value="34" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Padding" Value="6,4" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RichTextBox}">
                    <Grid>
                        <Border
                            x:Name="MainBorder"
                            Padding="0"
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            CornerRadius="4"
                            Focusable="False">
                            <ScrollViewer
                                x:Name="PART_ContentHost"
                                Margin="0,0,2,0"
                                Padding="{TemplateBinding Padding}"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                Foreground="{TemplateBinding Foreground}"
                                HorizontalScrollBarVisibility="{TemplateBinding HorizontalScrollBarVisibility}"
                                VerticalScrollBarVisibility="{TemplateBinding VerticalScrollBarVisibility}" />
                        </Border>
                        <Border
                            x:Name="AccentBorder"
                            HorizontalAlignment="Stretch"
                            VerticalAlignment="Stretch"
                            BorderBrush="{DynamicResource ControlStrokeColorDefaultBrush}"
                            BorderThickness="{StaticResource RichTextBoxAccentBorderThemeThickness}"
                            CornerRadius="{DynamicResource ControlCornerRadius}" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsEnabled" Value="True" />
                                <Condition Property="IsMouseOver" Value="True" />
                                <Condition Property="IsFocused" Value="False" />
                            </MultiTrigger.Conditions>
                            <Setter Property="Background" Value="{DynamicResource TextControlBackgroundPointerOver}" />
                        </MultiTrigger>
                        <Trigger Property="IsFocused" Value="True">
                            <Setter TargetName="AccentBorder" Property="BorderThickness" Value="0,0,0,2" />
                            <Setter TargetName="AccentBorder" Property="BorderBrush" Value="{DynamicResource TextControlFocusedBorderBrush}" />
                            <Setter Property="Background" Value="{DynamicResource TextControlBackgroundFocused}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
               </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style BasedOn="{StaticResource DefaultRichTextBoxStyle}" TargetType="{x:Type RichTextBox}" />

</ResourceDictionary>
