|
7 | 7 |
|
8 | 8 | <ResourceDictionary
|
9 | 9 | xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
10 |
| - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > |
11 |
| - |
| 10 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 11 | + xmlns:system="clr-namespace:System;assembly=System.Runtime" > |
| 12 | + |
| 13 | + <!-- Deprecated RichTextBox Resources ( Used in .NET 9 ) --> |
12 | 14 | <Thickness x:Key="RichTextBoxAccentBorderThemeThickness">0,0,0,1</Thickness>
|
| 15 | + |
| 16 | + <!-- Instead of RichTextBoxThemeMinHeight, we need to use TextControlThemeMinHeight, but modifying that right now |
| 17 | + will affect the other styles as well. Once the remaining styles using it are fixed, will remove this resource --> |
| 18 | + <system:Double x:Key="RichTextBoxThemeMinHeight">32</system:Double> |
13 | 19 |
|
14 | 20 | <Style x:Key="DefaultRichTextBoxStyle" TargetType="{x:Type RichTextBox}">
|
| 21 | + <Setter Property="FocusVisualStyle" Value="{x:Null}" /> |
| 22 | + <Setter Property="ContextMenu" Value="{DynamicResource DefaultControlContextMenu}" /> |
15 | 23 | <Setter Property="Foreground" Value="{DynamicResource TextControlForeground}" />
|
16 | 24 | <Setter Property="CaretBrush" Value="{DynamicResource TextControlForeground}" />
|
17 | 25 | <Setter Property="Background" Value="{DynamicResource TextControlBackground}" />
|
18 |
| - <Setter Property="BorderBrush" Value="{DynamicResource TextControlElevationBorderBrush}" /> |
19 |
| - <Setter Property="FocusVisualStyle" Value="{x:Null}" /> |
20 |
| - <Setter Property="VerticalScrollBarVisibility" Value="Auto" /> |
21 |
| - <Setter Property="HorizontalScrollBarVisibility" Value="Disabled" /> |
22 |
| - <Setter Property="HorizontalAlignment" Value="Stretch" /> |
23 |
| - <Setter Property="VerticalAlignment" Value="Stretch" /> |
24 |
| - <Setter Property="MinHeight" Value="34" /> |
25 |
| - <Setter Property="BorderThickness" Value="1" /> |
26 |
| - <Setter Property="Padding" Value="6,4" /> |
27 |
| - <Setter Property="SnapsToDevicePixels" Value="True" /> |
| 26 | + <Setter Property="BorderBrush" Value="{DynamicResource TextControlBorderBrush}" /> |
| 27 | + <Setter Property="BorderThickness" Value="{StaticResource TextControlBorderThemeThickness}" /> |
| 28 | + <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" /> |
| 29 | + <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" /> |
| 30 | + <Setter Property="HorizontalContentAlignment" Value="Left" /> |
| 31 | + <Setter Property="VerticalContentAlignment" Value="Top" /> |
| 32 | + <Setter Property="Cursor" Value="IBeam" /> |
| 33 | + <Setter Property="MinHeight" Value="{DynamicResource RichTextBoxThemeMinHeight}" /> |
| 34 | + <Setter Property="MinWidth" Value="{DynamicResource TextControlThemeMinWidth}" /> |
| 35 | + <Setter Property="Padding" Value="{DynamicResource TextControlThemePadding}" /> |
| 36 | + <Setter Property="Border.CornerRadius" Value="{DynamicResource ControlCornerRadius}" /> |
| 37 | + <Setter Property="AllowDrop" Value="True"/> |
| 38 | + <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/> |
| 39 | + <Setter Property="Stylus.IsFlicksEnabled" Value="False"/> |
28 | 40 | <Setter Property="OverridesDefaultStyle" Value="True" />
|
29 | 41 | <Setter Property="Template">
|
30 | 42 | <Setter.Value>
|
31 | 43 | <ControlTemplate TargetType="{x:Type RichTextBox}">
|
32 | 44 | <Grid>
|
33 | 45 | <Border
|
34 |
| - x:Name="MainBorder" |
35 |
| - Padding="0" |
| 46 | + x:Name="ContentBorder" |
| 47 | + MinWidth="{TemplateBinding MinWidth}" |
| 48 | + MinHeight="{TemplateBinding MinHeight}" |
36 | 49 | Background="{TemplateBinding Background}"
|
37 | 50 | BorderBrush="{TemplateBinding BorderBrush}"
|
38 | 51 | BorderThickness="{TemplateBinding BorderThickness}"
|
39 |
| - CornerRadius="4" |
40 |
| - Focusable="False"> |
41 |
| - <ScrollViewer |
42 |
| - x:Name="PART_ContentHost" |
43 |
| - Margin="0,0,2,0" |
44 |
| - Padding="{TemplateBinding Padding}" |
45 |
| - HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" |
46 |
| - VerticalAlignment="{TemplateBinding VerticalContentAlignment}" |
47 |
| - Foreground="{TemplateBinding Foreground}" |
48 |
| - HorizontalScrollBarVisibility="{TemplateBinding HorizontalScrollBarVisibility}" |
49 |
| - VerticalScrollBarVisibility="{TemplateBinding VerticalScrollBarVisibility}" /> |
50 |
| - </Border> |
51 |
| - <Border |
52 |
| - x:Name="AccentBorder" |
53 |
| - HorizontalAlignment="Stretch" |
54 |
| - VerticalAlignment="Stretch" |
55 |
| - BorderBrush="{DynamicResource ControlStrokeColorDefaultBrush}" |
56 |
| - BorderThickness="{StaticResource RichTextBoxAccentBorderThemeThickness}" |
57 |
| - CornerRadius="{DynamicResource ControlCornerRadius}" /> |
| 52 | + CornerRadius="{TemplateBinding Border.CornerRadius}" /> |
| 53 | + |
| 54 | + <ScrollViewer |
| 55 | + x:Name="PART_ContentHost" |
| 56 | + Margin="{TemplateBinding BorderThickness}" |
| 57 | + CanContentScroll="{TemplateBinding ScrollViewer.CanContentScroll}" |
| 58 | + HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" |
| 59 | + IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}" |
| 60 | + IsTabStop="{TemplateBinding ScrollViewer.IsTabStop}" |
| 61 | + Padding="{TemplateBinding Padding}" |
| 62 | + TextElement.Foreground="{TemplateBinding Foreground}" |
| 63 | + VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}" /> |
58 | 64 | </Grid>
|
59 | 65 | <ControlTemplate.Triggers>
|
60 |
| - <MultiTrigger> |
61 |
| - <MultiTrigger.Conditions> |
62 |
| - <Condition Property="IsEnabled" Value="True" /> |
63 |
| - <Condition Property="IsMouseOver" Value="True" /> |
64 |
| - <Condition Property="IsFocused" Value="False" /> |
65 |
| - </MultiTrigger.Conditions> |
66 |
| - <Setter Property="Background" Value="{DynamicResource TextControlBackgroundPointerOver}" /> |
67 |
| - </MultiTrigger> |
| 66 | + <Trigger Property="IsMouseOver" Value="True"> |
| 67 | + <Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource TextControlBackgroundPointerOver}" /> |
| 68 | + <Setter TargetName="ContentBorder" Property="BorderBrush" Value="{DynamicResource TextControlBorderBrushPointerOver}" /> |
| 69 | + <Setter TargetName="PART_ContentHost" Property="Foreground" Value="{DynamicResource TextControlForegroundPointerOver}" /> |
| 70 | + </Trigger> |
68 | 71 | <Trigger Property="IsFocused" Value="True">
|
69 |
| - <Setter TargetName="AccentBorder" Property="BorderThickness" Value="0,0,0,2" /> |
70 |
| - <Setter TargetName="AccentBorder" Property="BorderBrush" Value="{DynamicResource TextControlFocusedBorderBrush}" /> |
71 |
| - <Setter Property="Background" Value="{DynamicResource TextControlBackgroundFocused}" /> |
| 72 | + <Setter TargetName="ContentBorder" Property="BorderThickness" Value="{StaticResource TextControlBorderThemeThicknessFocused}" /> |
| 73 | + <Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource TextControlBackgroundFocused}" /> |
| 74 | + <Setter TargetName="ContentBorder" Property="BorderBrush" Value="{DynamicResource TextControlBorderBrushFocused}" /> |
| 75 | + <Setter TargetName="PART_ContentHost" Property="Foreground" Value="{DynamicResource TextControlForegroundFocused}" /> |
| 76 | + </Trigger> |
| 77 | + <Trigger Property="IsEnabled" Value="False"> |
| 78 | + <Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource TextControlBackgroundDisabled}" /> |
| 79 | + <Setter TargetName="ContentBorder" Property="BorderBrush" Value="{DynamicResource TextControlBorderBrushDisabled}" /> |
| 80 | + <Setter TargetName="PART_ContentHost" Property="Foreground" Value="{DynamicResource TextControlForegroundDisabled}" /> |
72 | 81 | </Trigger>
|
73 | 82 | </ControlTemplate.Triggers>
|
74 |
| - </ControlTemplate> |
| 83 | + </ControlTemplate> |
75 | 84 | </Setter.Value>
|
76 | 85 | </Setter>
|
77 | 86 | </Style>
|
|
0 commit comments