<UserControl x:Class="HavenSoft.HexManiac.WPF.Controls.TextEditor"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:HavenSoft.HexManiac.WPF.Controls">
   <Grid Background="{DynamicResource Backlight}" TextBlock.FontFamily="Consolas" ClipToBounds="True">
      <Canvas ClipToBounds="False" Width="0" HorizontalAlignment="Left">
         <TextBlock Name="BasicLayer" Foreground="{DynamicResource Primary}" Margin="2" Text="{Binding PlainContent}">
            <TextBlock.RenderTransform>
               <TranslateTransform />
            </TextBlock.RenderTransform>
         </TextBlock>
         <TextBlock Name="AccentLayer" Foreground="{DynamicResource Accent}" Margin="2" Text="{Binding AccentContent}">
            <TextBlock.RenderTransform>
               <TranslateTransform />
            </TextBlock.RenderTransform>
         </TextBlock>
         <TextBlock Name="ConstantsLayer" Foreground="{DynamicResource Data1}" Margin="2" Text="{Binding ConstantContent}">
            <TextBlock.RenderTransform>
               <TranslateTransform />
            </TextBlock.RenderTransform>
         </TextBlock>
         <TextBlock Name="TextLayer" Foreground="{DynamicResource Text1}" Margin="2" Text="{Binding TextContent}">
            <TextBlock.RenderTransform>
               <TranslateTransform />
            </TextBlock.RenderTransform>
         </TextBlock>
         <TextBlock Name="NumericLayer" Foreground="{DynamicResource Data2}" Margin="2" Text="{Binding NumericContent}">
            <TextBlock.RenderTransform>
               <TranslateTransform />
            </TextBlock.RenderTransform>
         </TextBlock>
         <TextBlock Name="CommentLayer" Foreground="{DynamicResource Secondary}" Margin="2">
            <TextBlock.RenderTransform>
               <TranslateTransform />
            </TextBlock.RenderTransform>
         </TextBlock>
      </Canvas>
      <TextBox Name="TransparentLayer" Background="Transparent" CaretBrush="{DynamicResource Primary}" Foreground="Transparent"
               VerticalScrollBarVisibility="Auto"
               UndoLimit="0" AcceptsReturn="True" AcceptsTab="True" ScrollViewer.ScrollChanged="TextScrollChanged" HorizontalScrollBarVisibility="Auto"
         Tag="{Binding Tag, RelativeSource={RelativeSource AncestorType=local:TextEditor}}"
         ContextMenu="{Binding ContextMenuOverride, RelativeSource={RelativeSource AncestorType=local:TextEditor}}"
         Text="{Binding Content, UpdateSourceTrigger=PropertyChanged}" />
      <Rectangle Name="CornerCover" HorizontalAlignment="Right" VerticalAlignment="Bottom" Fill="{DynamicResource Background}" Margin="1" SnapsToDevicePixels="True" />
   </Grid>
</UserControl>
