<!--// Copyright © GrapeCity, Inc..
// This file is part of the ComponentOne Studio UWP Edition
// Please visit https://www.grapecity.com/en/componentone for details
// All other rights reserved.
-->

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:c1="using:C1.Xaml"
    xmlns:c1RTB="using:C1.Xaml.RichTextBox"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
    <ResourceDictionary.ThemeDictionaries>
        <ResourceDictionary x:Key="HighContrast">
            <SolidColorBrush x:Key="TextBoxBackgroundThemeBrush" Color="Black"/>
            <SolidColorBrush x:Key="TextBoxForegroundThemeBrush" Color="#FFFFFF00"/>
        </ResourceDictionary>
        <ResourceDictionary x:Key="HighContrastBlack">
            <SolidColorBrush x:Key="TextBoxBackgroundThemeBrush" Color="Black"/>
            <SolidColorBrush x:Key="TextBoxForegroundThemeBrush" Color="White"/>
        </ResourceDictionary>
        <ResourceDictionary x:Key="HighContrastWhite">
            <SolidColorBrush x:Key="TextBoxBackgroundThemeBrush" Color="White"/>
            <SolidColorBrush x:Key="TextBoxForegroundThemeBrush" Color="Black"/>
        </ResourceDictionary>
    </ResourceDictionary.ThemeDictionaries>
   
    <!-- Default Settings -->
    <SolidColorBrush x:Key="DisabledBrush" Color="#A5FFFFFF"/>
    <SolidColorBrush x:Key="BorderBrush" Color="#FF7F98A9"/>
    <SolidColorBrush x:Key="Background" Color="White"/>
    <Style x:Key="FocusStyle" TargetType="Border">
        <Setter Property="CornerRadius" Value="2" />
        <Setter Property="Opacity" Value="0" />
        <Setter Property="BorderBrush" Value="{ThemeResource SystemControlHighlightAccentBrush}" />
    </Style>
    <Style x:Key="DisabledStyle" TargetType="Border">
        <Setter Property="Background" Value="{StaticResource DisabledBrush}" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Opacity" Value="0" />
        <Setter Property="IsHitTestVisible" Value="False" />
        <Setter Property="CornerRadius" Value="2" />
    </Style>
    <Style x:Key="ScrollBarClearStyle" TargetType="ScrollBar">
        <Setter Property="SmallChange" Value="16" />
        <Setter Property="Opacity" Value="0.85" />
    </Style>

    <!-- Default style for C1.Xaml.C1RichTextBox -->
    <Style TargetType="c1RTB:C1RichTextBox">
        <Setter Property="Background" Value="{ThemeResource SystemControlBackgroundAltHighBrush}"/>
        <Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}" />
        <Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundChromeDisabledLowBrush}"/>
        <Setter Property="BorderThickness" Value="{ThemeResource TextControlBorderThemeThickness}"/>
        <Setter Property="Padding" Value="{ThemeResource TextControlThemePadding}"/>
        <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
        <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="VerticalContentAlignment" Value="Top"/>
        <Setter Property="SelectionBackground" Value="{ThemeResource SystemControlHighlightAccentBrush }"/>
        <Setter Property="SelectionForeground" Value="{ThemeResource ListBoxItemSelectedForegroundThemeBrush }"/>
        <Setter Property="ScrollBarStyle" Value="{StaticResource ScrollBarClearStyle}"/>
        <Setter Property="PrintPageLayout">
            <Setter.Value>
                <c1RTB:C1PageLayout Height="1056" Width="816" Padding="96" Background="White" Margin="4" />
            </Setter.Value>
        </Setter>
        <Setter Property="PrintPanelTemplate">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <c1RTB:C1PagesPanel />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="PrintTemplate">
            <Setter.Value>
                <DataTemplate>
                    <Grid Margin="{Binding ViewManager.PresenterInfo.Margin}">
                        <Grid.Resources>
                            <c1:ZoomToScaleTransformConverter x:Key="zoomConverter" />
                        </Grid.Resources>
                        <Border BorderThickness="1" BorderBrush="#FF858585" Background="{Binding ViewManager.PresenterInfo.Background}"/>
                        <c1:C1LayoutTransformer LayoutTransform="{Binding ViewManager.PresenterInfo.Zoom, Converter={StaticResource zoomConverter}}">
                            <Grid Height="{Binding ViewManager.PresenterInfo.Height}" Width="{Binding ViewManager.PresenterInfo.Width}">
                                <c1RTB:C1RichTextPresenter Source="{Binding}" Margin="{Binding ViewManager.PresenterInfo.Padding}"/>
                            </Grid>
                        </c1:C1LayoutTransformer>
                    </Grid>
                </DataTemplate>
            </Setter.Value>
        </Setter>

        <Setter Property="UIContainerResizeTemplate">
            <Setter.Value>
                <DataTemplate>
                    <Grid UseLayoutRounding="True" Background="Transparent">
                        <Grid.Resources>
                            <Style TargetType="Border" x:Key="thumb">
                                <Setter Property="Width" Value="20" />
                                <Setter Property="Height" Value="20" />
                                <Setter Property="Background" Value="White" />
                                <Setter Property="BorderBrush" Value="Black" />
                                <Setter Property="BorderThickness" Value="1" />
                                <Setter Property="Margin" Value="-10" />
                            </Style>
                        </Grid.Resources>
                        <Border BorderBrush="Black" BorderThickness="1" IsHitTestVisible="False"/>

                        <Border Style="{StaticResource thumb}" HorizontalAlignment="Left" VerticalAlignment="Center" c1RTB:C1ResizePainter.Direction="-1,0"/>
                        <Border Style="{StaticResource thumb}" HorizontalAlignment="Right" VerticalAlignment="Center" c1RTB:C1ResizePainter.Direction="1,0"/>
                        <Border Style="{StaticResource thumb}" HorizontalAlignment="Center" VerticalAlignment="Top" c1RTB:C1ResizePainter.Direction="0,-1"/>
                        <Border Style="{StaticResource thumb}" HorizontalAlignment="Center" VerticalAlignment="Bottom" c1RTB:C1ResizePainter.Direction="0,1"/>

                        <Border Style="{StaticResource thumb}" HorizontalAlignment="Left" VerticalAlignment="Top" c1RTB:C1ResizePainter.Direction="-1,-1"/>
                        <Border Style="{StaticResource thumb}" HorizontalAlignment="Left" VerticalAlignment="Bottom"  c1RTB:C1ResizePainter.Direction="-1,1"/>
                        <Border Style="{StaticResource thumb}" HorizontalAlignment="Right" VerticalAlignment="Top" c1RTB:C1ResizePainter.Direction="1,-1"/>
                        <Border Style="{StaticResource thumb}" HorizontalAlignment="Right" VerticalAlignment="Bottom" c1RTB:C1ResizePainter.Direction="1,1"/>
                    </Grid>
                </DataTemplate>
            </Setter.Value>
        </Setter>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="c1RTB:C1RichTextBox">
                    <Grid MinHeight="23" x:Name="Root">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="WritableStates">
                                <VisualState x:Name="Writable" />
                                <VisualState x:Name="ReadOnly" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="DisabledVisual" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.0"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="PointerOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0:0:0.1" Storyboard.TargetName="FocusVisual" Storyboard.TargetProperty="Opacity" To="1" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Unfocused"/>
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0:0:0.1" Storyboard.TargetName="FocusVisual" Storyboard.TargetProperty="Opacity" To="1" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ValidationStates">
                                <VisualState x:Name="Valid"/>
                                <VisualState x:Name="InvalidUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationDecorator" Storyboard.TargetProperty="ValidationState">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <c1:ValidationState>InvalidUnfocused</c1:ValidationState>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="InvalidFocused" >
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationDecorator" Storyboard.TargetProperty="ValidationState">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <c1:ValidationState>InvalidFocused</c1:ValidationState>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <Border Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" >
                            <Grid x:Name="Container" Background="Transparent">
                                <ContentControl
								    x:Name="Watermark"
								    IsTabStop="False"
								    IsHitTestVisible="False"
								    Content="{TemplateBinding Watermark}"
								    Foreground="{TemplateBinding Foreground}"
								    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
								    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
								    Opacity="0.65"
								    Visibility="Collapsed"/>
                                <Grid x:Name="Content" Margin="{TemplateBinding Padding}" Background="Transparent" />
                                <Ellipse x:Name="SelectionStartThumb" HorizontalAlignment="Left" VerticalAlignment="Top" Visibility="Collapsed" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding Foreground}" StrokeThickness="3" Height="20" Width="20" />
                                <Ellipse x:Name="SelectionEndThumb" HorizontalAlignment="Left" VerticalAlignment="Top" Visibility="Collapsed" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding Foreground}" StrokeThickness="3" Height="20" Width="20" />
                                <Ellipse x:Name="CursorThumb" HorizontalAlignment="Left" VerticalAlignment="Top" Visibility="Collapsed" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding Foreground}" StrokeThickness="3" Height="20" Width="20" />
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="*"/>
                                        <RowDefinition Height="Auto"/>
                                    </Grid.RowDefinitions>
                                    <ScrollBar x:Name="VerticalScrollBar" Grid.Column="1" Orientation="Vertical" Style="{TemplateBinding ScrollBarStyle}"/>
                                    <ScrollBar x:Name="HorizontalScrollBar" Grid.Row="1" Orientation="Horizontal" Style="{TemplateBinding ScrollBarStyle}"/>
                                </Grid>
                            </Grid>
                        </Border>
                        <Border x:Name="FocusVisual" Style="{StaticResource FocusStyle}" BorderThickness="{TemplateBinding BorderThickness}" Visibility="{TemplateBinding FocusCuesVisibility}" />
                        <Border x:Name="DisabledVisual" Style="{StaticResource DisabledStyle}" Visibility="{TemplateBinding DisabledCuesVisibility}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="c1RTB:C1RichTextPresenter">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="c1RTB:C1RichTextPresenter">
                    <Canvas x:Name="Content" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
