<Grid
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:vsm="using:Windows.UI.Xaml"
  x:Name="StickyGrid"
  Width="320" Height="150" x:Uid="Layout">
    <Grid.Resources>
        <ResourceDictionary>
            <ResourceDictionary.ThemeDictionaries>
                <ResourceDictionary x:Key="Default">
                    <!-- Default theme resources -->
                    <SolidColorBrush x:Key="ReaderStickyBackground" Color="#FFFDFDCB"/>
                    <SolidColorBrush x:Key="ReaderStickyForeground" Color="Black"/>
                    <SolidColorBrush x:Key="ReaderStickyBorderBrush" Color="#FFEAE9AD"/>
                    <SolidColorBrush x:Key="ReaderStickyBorderFocusBrush" Color="#FFC7C7B0"/>
                    <SolidColorBrush x:Key="ReaderStickyBackgroundHoverBrush" Color="#FFFEFEEA"/>
                    <SolidColorBrush x:Key="ReaderStickyBackgroundFocusBrush" Color="#FFFFFFF5"/>
                </ResourceDictionary>

                <ResourceDictionary x:Key="HighContrast">
                    <!-- High Contrast theme resources -->
                    <SolidColorBrush x:Key="ReaderStickyBackground" Color="{StaticResource SystemColorWindowColor}"/>
                    <SolidColorBrush x:Key="ReaderStickyForeground" Color="{StaticResource SystemColorWindowTextColor}"/>
                    <SolidColorBrush x:Key="ReaderStickyBorderBrush" Color="{StaticResource SystemColorHighlightColor}"/>
                    <SolidColorBrush x:Key="ReaderStickyBorderFocusBrush" Color="{StaticResource SystemColorHighlightColor}"/>
                    <SolidColorBrush x:Key="ReaderStickyBackgroundHoverBrush" Color="{StaticResource SystemColorWindowColor}"/>
                    <SolidColorBrush x:Key="ReaderStickyBackgroundFocusBrush" Color="{StaticResource SystemColorWindowColor}"/>
                </ResourceDictionary>
            </ResourceDictionary.ThemeDictionaries>
        </ResourceDictionary>

        <Style x:Key="StickyTextBoxStyle" TargetType="TextBox">
            <Setter Property="FontFamily" Value="{StaticResource ContentControlThemeFontFamily}" />
            <Setter Property="FontSize" Value="14.667" />
            <Setter Property="Foreground" Value="{StaticResource ReaderStickyForeground}" />
            <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
            <Setter Property="Padding" Value="15,9,20,20"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="TextBox">
                        <Grid>
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Disabled"/>
                                    <VisualState x:Name="Normal"/>
                                    <VisualState x:Name="PointerOver">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="Background">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ReaderStickyBackgroundHoverBrush}" />
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Focused">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="BorderBrush">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ReaderStickyBorderFocusBrush}" />
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="Background">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ReaderStickyBackgroundFocusBrush}" />
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Border x:Name="BorderElement"
                                BorderBrush="{StaticResource ReaderStickyBorderBrush}"
								Background="{StaticResource ReaderStickyBackground}"
                                BorderThickness="2"/>
                            <ScrollViewer x:Name="ContentElement"
                                      IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
                                      HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
                                      HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
                                      IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
                                      VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
                                      VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
                                      Margin="{TemplateBinding BorderThickness}"
                                      Padding="{TemplateBinding Padding}"
                                      IsTabStop="False"
                                      ZoomMode="{TemplateBinding ScrollViewer.ZoomMode}" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Grid.Resources>

    <TextBox x:Name="StickyText" Style="{StaticResource StickyTextBoxStyle}" IsTextPredictionEnabled="True" IsSpellCheckEnabled="True" TextWrapping="Wrap" AcceptsReturn="True"/>
</Grid>