style<*>: text render styles

This commit is contained in:
leo 2021-08-05 13:44:25 +08:00
parent 316344939a
commit 76a4e37736
31 changed files with 139 additions and 144 deletions

View file

@ -30,5 +30,4 @@
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource Style.Button}"/>
</ResourceDictionary>

View file

@ -7,6 +7,7 @@
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}"/>
<Setter Property="MinHeight" Value="24"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="TextElement.FontFamily" Value="Microsoft YaHei UI"/>
<Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
<Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>

View file

@ -4,6 +4,7 @@
<Style x:Key="Style.DataGridCell" TargetType="{x:Type DataGridCell}">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
@ -15,7 +16,6 @@
<Style x:Key="Style.DataGridRow" TargetType="{x:Type DataGridRow}">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled" />
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
@ -44,7 +44,7 @@
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="TextElement.Foreground" Value="{DynamicResource Brush.FG1}"/>
<Setter Property="TextElement.FontFamily" Value="Consolas"/>
<Setter Property="TextElement.FontFamily" Value="Consolas,Microsoft YaHei UI"/>
<Setter Property="EnableColumnVirtualization" Value="True"/>
<Setter Property="EnableRowVirtualization" Value="True"/>
<Setter Property="RowBackground" Value="Transparent"/>

View file

@ -2,6 +2,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="{x:Type Hyperlink}">
<Setter Property="TextDecorations" Value="{x:Null}"/>
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="{DynamicResource Brush.Accent1}"/>

View file

@ -4,6 +4,7 @@
<Setter Property="Padding" Value="0"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="SnapsToDevicePixels" Value="true"/>
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListViewItem}">

View file

@ -5,6 +5,5 @@
<Setter Property="Fill" Value="{DynamicResource Brush.FG1}"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="RenderOptions.BitmapScalingMode" Value="HighQuality"/>
</Style>
</ResourceDictionary>

View file

@ -46,9 +46,12 @@
ContentSource="Header"
Margin="8,4">
<ContentPresenter.Resources>
<Style TargetType="{x:Type TextBlock}">
<Style TargetType="{x:Type TextBlock}" BasedOn="{x:Null}">
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}"/>
<Setter Property="FontWeight" Value="DemiBold"/>
<Setter Property="FontFamily" Value="Microsoft YaHei UI"/>
<Setter Property="FontSize" Value="9pt"/>
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabItem}}, Path=IsSelected}" Value="True">
<Setter Property="Foreground" Value="{DynamicResource Brush.Accent1}"/>

View file

@ -1,28 +1,52 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="{x:Type TextBlock}">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:SourceGit.Views.Controls">
<Style x:Key="Style.TextBlock.Base" TargetType="{x:Type TextBlock}">
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="FontFamily" Value="Consolas,Microsoft YaHei UI"/>
<Setter Property="FontSize" Value="9pt"/>
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
<Setter Property="TextOptions.TextHintingMode" Value="Animated"/>
<Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
</Style>
<Style x:Key="Style.TextBlock.LineNumber" TargetType="{x:Type TextBlock}">
<Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource Style.TextBlock.Base}"/>
<Style x:Key="Style.TextBlock.Group" TargetType="{x:Type TextBlock}" BasedOn="{x:Null}">
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="Foreground" Value="{DynamicResource Brush.FG2}"/>
<Setter Property="FontFamily" Value="Microsoft YaHei UI"/>
<Setter Property="FontWeight" Value="ExtraBold"/>
<Setter Property="FontSize" Value="9pt"/>
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="Margin" Value="8,0,0,0"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<Style x:Key="Style.TextBlock.Header" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource Style.TextBlock.Group}">
<Setter Property="HorizontalAlignment" Value="Right"/>
</Style>
<Style x:Key="Style.TextBlock.LineNumber" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource Style.TextBlock.Base}">
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="Padding" Value="8,0"/>
</Style>
<Style x:Key="Style.TextBlock.LineContent" TargetType="{x:Type TextBlock}">
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="FontSize" Value="9pt"/>
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Style x:Key="Style.TextBlock.LineContent" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource Style.TextBlock.Base}">
<Setter Property="Margin" Value="0"/>
<Setter Property="Padding" Value="4,0,0,0"/>
</Style>
<Style TargetType="{x:Type controls:HighlightableTextBlock}" BasedOn="{StaticResource Style.TextBlock.Base}">
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="FontSize" Value="13"/>
<Setter Property="LineHeight" Value="16"/>
<Setter Property="Margin" Value="0"/>
<Setter Property="Padding" Value="4,0,0,0"/>
</Style>
</ResourceDictionary>

View file

@ -7,6 +7,7 @@
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="TextElement.FontFamily" Value="Consolas,Microsoft YaHei UI"/>
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}"/>
<Setter Property="CaretBrush" Value="{DynamicResource Brush.FG1}"/>
<Setter Property="Background" Value="Transparent"/>
@ -67,6 +68,7 @@
Background="Transparent"
BorderThickness="0"
IsTabStop="False"
RenderOptions.ClearTypeHint="Enabled"
CanContentScroll="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Border>

View file

@ -2,6 +2,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="{x:Type ToolTip}">
<Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
<Setter Property="HasDropShadow" Value="False"/>
<Setter Property="Template">
<Setter.Value>

View file

@ -28,7 +28,7 @@
<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, Mode=OneWay, FallbackValue=Stretch, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
<Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, Mode=OneWay, FallbackValue=Center, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled" />
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:TreeItem}">

View file

@ -11,6 +11,7 @@
<Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
<Setter Property="TextOptions.TextHintingMode" Value="Animated"/>
<Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
<Setter Property="WindowChrome.WindowChrome">
<Setter.Value>