1 | <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
---|
2 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
---|
3 | xmlns:AvalonEdit="clr-namespace:ICSharpCode.AvalonEdit" |
---|
4 | xmlns:editing="clr-namespace:ICSharpCode.AvalonEdit.Editing" |
---|
5 | > |
---|
6 | <Style TargetType="{x:Type AvalonEdit:TextEditor}"> |
---|
7 | <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" /> |
---|
8 | <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" /> |
---|
9 | <Setter Property="FlowDirection" Value="LeftToRight"/> <!-- AvalonEdit does not support RTL, so ensure we use LTR by default --> |
---|
10 | <Setter Property="Template"> |
---|
11 | <Setter.Value> |
---|
12 | <ControlTemplate TargetType="{x:Type AvalonEdit:TextEditor}"> |
---|
13 | <ScrollViewer |
---|
14 | Focusable="False" |
---|
15 | Name="PART_ScrollViewer" |
---|
16 | CanContentScroll="True" |
---|
17 | VerticalScrollBarVisibility="{TemplateBinding VerticalScrollBarVisibility}" |
---|
18 | HorizontalScrollBarVisibility="{TemplateBinding HorizontalScrollBarVisibility}" |
---|
19 | Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TextArea}" |
---|
20 | VerticalContentAlignment="Top" |
---|
21 | HorizontalContentAlignment="Left" |
---|
22 | Background="{TemplateBinding Background}" |
---|
23 | Padding="{TemplateBinding Padding}" |
---|
24 | BorderBrush="{TemplateBinding BorderBrush}" |
---|
25 | BorderThickness="{TemplateBinding BorderThickness}" |
---|
26 | /> |
---|
27 | <ControlTemplate.Triggers> |
---|
28 | <Trigger Property="WordWrap" |
---|
29 | Value="True"> |
---|
30 | <Setter TargetName="PART_ScrollViewer" |
---|
31 | Property="HorizontalScrollBarVisibility" |
---|
32 | Value="Disabled" /> |
---|
33 | </Trigger> |
---|
34 | </ControlTemplate.Triggers> |
---|
35 | </ControlTemplate> |
---|
36 | </Setter.Value> |
---|
37 | </Setter> |
---|
38 | </Style> |
---|
39 | |
---|
40 | <Style TargetType="{x:Type editing:TextArea}" x:Shared="False"> |
---|
41 | <Setter Property="FocusVisualStyle" Value="{x:Null}"/> |
---|
42 | <Setter Property="SelectionBrush"> |
---|
43 | <Setter.Value> |
---|
44 | <SolidColorBrush |
---|
45 | Color="{DynamicResource {x:Static SystemColors.HighlightColorKey}}" |
---|
46 | Opacity="0.7"/> |
---|
47 | </Setter.Value> |
---|
48 | </Setter> |
---|
49 | <Setter Property="SelectionBorder"> |
---|
50 | <Setter.Value> |
---|
51 | <Pen Brush="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" |
---|
52 | Thickness="1"/> |
---|
53 | </Setter.Value> |
---|
54 | </Setter> |
---|
55 | <Setter Property="SelectionForeground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/> |
---|
56 | <Setter Property="Template"> |
---|
57 | <Setter.Value> |
---|
58 | <ControlTemplate TargetType="{x:Type editing:TextArea}"> |
---|
59 | <DockPanel Focusable="False"> |
---|
60 | <ItemsControl DockPanel.Dock="Left" |
---|
61 | Focusable="False" |
---|
62 | ItemsSource="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=LeftMargins}"> |
---|
63 | <ItemsControl.ItemsPanel> |
---|
64 | <ItemsPanelTemplate> |
---|
65 | <StackPanel Orientation="Horizontal" /> |
---|
66 | </ItemsPanelTemplate> |
---|
67 | </ItemsControl.ItemsPanel> |
---|
68 | </ItemsControl> |
---|
69 | <ContentPresenter |
---|
70 | Panel.ZIndex="-1" |
---|
71 | Focusable="False" |
---|
72 | Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TextView}"/> |
---|
73 | </DockPanel> |
---|
74 | </ControlTemplate> |
---|
75 | </Setter.Value> |
---|
76 | </Setter> |
---|
77 | </Style> |
---|
78 | </ResourceDictionary> |
---|