RichTextBox.xaml 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:hc="clr-namespace:HandyControl.Controls">
  4. <Style x:Key="TextBoxBaseBaseStyle" TargetType="TextBoxBase">
  5. <Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
  6. <Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
  7. <Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
  8. <Setter Property="BorderThickness" Value="1"/>
  9. <Setter Property="CaretBrush" Value="{DynamicResource PrimaryTextBrush}"/>
  10. <Setter Property="hc:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}"/>
  11. <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
  12. <Setter Property="HorizontalContentAlignment" Value="Left"/>
  13. <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
  14. <Setter Property="AllowDrop" Value="true"/>
  15. <Setter Property="Padding" Value="2,7"/>
  16. <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
  17. <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Hidden"/>
  18. <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden"/>
  19. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  20. <Setter Property="Template">
  21. <Setter.Value>
  22. <ControlTemplate TargetType="TextBoxBase">
  23. <Border x:Name="border" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
  24. <ScrollViewer x:Name="PART_ContentHost" Padding="{TemplateBinding Padding}" Focusable="false" HorizontalScrollBarVisibility="{Binding Path=(ScrollViewer.HorizontalScrollBarVisibility),RelativeSource={RelativeSource TemplatedParent}}" VerticalScrollBarVisibility="{Binding Path=(ScrollViewer.VerticalScrollBarVisibility),RelativeSource={RelativeSource TemplatedParent}}"/>
  25. </Border>
  26. <ControlTemplate.Triggers>
  27. <Trigger Property="IsEnabled" Value="false">
  28. <Setter Property="Opacity" TargetName="border" Value="0.4"/>
  29. </Trigger>
  30. <Trigger Property="IsMouseOver" Value="true">
  31. <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource SecondaryBorderBrush}"/>
  32. </Trigger>
  33. <Trigger Property="IsFocused" Value="true">
  34. <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource PrimaryBrush}"/>
  35. </Trigger>
  36. </ControlTemplate.Triggers>
  37. </ControlTemplate>
  38. </Setter.Value>
  39. </Setter>
  40. </Style>
  41. <Style x:Key="RichTextBoxBaseStyle" BasedOn="{StaticResource TextBoxBaseBaseStyle}" TargetType="RichTextBox">
  42. <Setter Property="MinWidth" Value="10"/>
  43. </Style>
  44. <Style BasedOn="{StaticResource RichTextBoxBaseStyle}" TargetType="RichTextBox"/>
  45. </ResourceDictionary>