|
65 | 65 | </Style.Triggers>
|
66 | 66 | </Style>
|
67 | 67 |
|
| 68 | + <ControlTemplate x:Key="{x:Static local:ToolkitResourceKeys.RichTextBoxControlTemplateKey}" TargetType="{x:Type RichTextBox}"> |
| 69 | + <!-- |
| 70 | + The default template for a RichTextBox defines a trigger for IsMouseOver that changes the |
| 71 | + border brush. To get our style triggers to apply, we need to override the template. |
| 72 | + --> |
| 73 | + <Border |
| 74 | + x:Name="border" |
| 75 | + BorderBrush="{TemplateBinding BorderBrush}" |
| 76 | + BorderThickness="{TemplateBinding BorderThickness}" |
| 77 | + Background="{TemplateBinding Background}" |
| 78 | + SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" |
| 79 | + > |
| 80 | + |
| 81 | + <ScrollViewer |
| 82 | + x:Name="PART_ContentHost" |
| 83 | + SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" |
| 84 | + /> |
| 85 | + </Border> |
| 86 | + </ControlTemplate> |
| 87 | + |
| 88 | + <Style x:Key="{x:Static local:ToolkitResourceKeys.RichTextBoxStyleKey}" TargetType="RichTextBox"> |
| 89 | + <Setter Property="Padding" Value="{StaticResource {x:Static local:ToolkitResourceKeys.InputPaddingKey}}" /> |
| 90 | + <Setter Property="Background" Value="{DynamicResource {x:Static local:InternalResourceKeys.CommonControlsColors_TextBoxBackgroundBrushKey}}" /> |
| 91 | + <Setter Property="Foreground" Value="{DynamicResource {x:Static local:InternalResourceKeys.CommonControlsColors_TextBoxTextBrushKey}}" /> |
| 92 | + <Setter Property="BorderBrush" Value="{DynamicResource {x:Static local:InternalResourceKeys.CommonControlsColors_TextBoxBorderBrushKey}}" /> |
| 93 | + |
| 94 | + <Setter Property="Template" Value="{StaticResource {x:Static local:ToolkitResourceKeys.RichTextBoxControlTemplateKey}}"/> |
| 95 | + |
| 96 | + <Style.Triggers> |
| 97 | + <Trigger Property="IsMouseOver" Value="True"> |
| 98 | + <Setter Property="Background" Value="{DynamicResource {x:Static local:InternalResourceKeys.CommonControlsColors_TextBoxBackgroundBrushKey}}" /> |
| 99 | + <Setter Property="Foreground" Value="{DynamicResource {x:Static local:InternalResourceKeys.CommonControlsColors_TextBoxTextBrushKey}}" /> |
| 100 | + <Setter Property="BorderBrush" Value="{DynamicResource {x:Static local:InternalResourceKeys.CommonControlsColors_TextBoxBorderBrushKey}}" /> |
| 101 | + </Trigger> |
| 102 | + |
| 103 | + <Trigger Property="IsFocused" Value="True"> |
| 104 | + <Setter Property="Background" Value="{DynamicResource {x:Static local:InternalResourceKeys.CommonControlsColors_TextBoxBackgroundFocusedBrushKey}}" /> |
| 105 | + <Setter Property="Foreground" Value="{DynamicResource {x:Static local:InternalResourceKeys.CommonControlsColors_TextBoxTextFocusedBrushKey}}" /> |
| 106 | + <Setter Property="BorderBrush" Value="{DynamicResource {x:Static local:InternalResourceKeys.CommonControlsColors_TextBoxBorderFocusedBrushKey}}" /> |
| 107 | + </Trigger> |
| 108 | + |
| 109 | + <Trigger Property="IsEnabled" Value="False"> |
| 110 | + <Setter Property="Background" Value="{DynamicResource {x:Static local:InternalResourceKeys.CommonControlsColors_TextBoxBackgroundDisabledBrushKey}}" /> |
| 111 | + <Setter Property="Foreground" Value="{DynamicResource {x:Static local:InternalResourceKeys.CommonControlsColors_TextBoxTextDisabledBrushKey}}" /> |
| 112 | + <Setter Property="BorderBrush" Value="{DynamicResource {x:Static local:InternalResourceKeys.CommonControlsColors_TextBoxBorderDisabledBrushKey}}" /> |
| 113 | + </Trigger> |
| 114 | + </Style.Triggers> |
| 115 | + </Style> |
| 116 | + |
68 | 117 | <!-- Default styles. -->
|
69 | 118 | <Style TargetType="TextBox" BasedOn="{StaticResource {x:Static local:ToolkitResourceKeys.TextBoxStyleKey}}" />
|
70 | 119 | <Style TargetType="ComboBox" BasedOn="{StaticResource {x:Static local:ToolkitResourceKeys.ComboBoxStyleKey}}" />
|
71 | 120 | <Style TargetType="PasswordBox" BasedOn="{StaticResource {x:Static local:ToolkitResourceKeys.PasswordBoxStyleKey}}" />
|
| 121 | + <Style TargetType="RichTextBox" BasedOn="{StaticResource {x:Static local:ToolkitResourceKeys.RichTextBoxStyleKey}}" /> |
72 | 122 | </ResourceDictionary>
|
0 commit comments