mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
style<*>: custom font style
This commit is contained in:
parent
780b4b9d18
commit
2c37ff98e6
5 changed files with 11 additions and 8 deletions
|
@ -1,10 +1,12 @@
|
||||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:models="clr-namespace:SourceGit.Models">
|
||||||
<Style TargetType="{x:Type ListViewItem}">
|
<Style TargetType="{x:Type ListViewItem}">
|
||||||
<Setter Property="Padding" Value="0"/>
|
<Setter Property="Padding" Value="0"/>
|
||||||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
||||||
<Setter Property="SnapsToDevicePixels" Value="true"/>
|
<Setter Property="SnapsToDevicePixels" Value="true"/>
|
||||||
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
|
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
|
||||||
|
<Setter Property="TextElement.FontFamily" Value="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}"/>
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate TargetType="{x:Type ListViewItem}">
|
<ControlTemplate TargetType="{x:Type ListViewItem}">
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:models="clr-namespace:SourceGit.Models">
|
||||||
<Style TargetType="{x:Type TabControl}">
|
<Style TargetType="{x:Type TabControl}">
|
||||||
<Setter Property="OverridesDefaultStyle" Value="True" />
|
<Setter Property="OverridesDefaultStyle" Value="True" />
|
||||||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||||
|
@ -51,6 +52,7 @@
|
||||||
<Setter Property="FontWeight" Value="DemiBold"/>
|
<Setter Property="FontWeight" Value="DemiBold"/>
|
||||||
<Setter Property="FontSize" Value="9pt"/>
|
<Setter Property="FontSize" Value="9pt"/>
|
||||||
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
|
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
|
||||||
|
<Setter Property="TextElement.FontFamily" Value="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyWindow, Mode=OneWay}"/>
|
||||||
<Style.Triggers>
|
<Style.Triggers>
|
||||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabItem}}, Path=IsSelected}" Value="True">
|
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabItem}}, Path=IsSelected}" Value="True">
|
||||||
<Setter Property="Foreground" Value="{DynamicResource Brush.Accent1}"/>
|
<Setter Property="Foreground" Value="{DynamicResource Brush.Accent1}"/>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:controls="clr-namespace:SourceGit.Views.Controls">
|
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
||||||
|
xmlns:models="clr-namespace:SourceGit.Models">
|
||||||
<Style x:Key="Style.TextBlock.Base" TargetType="{x:Type TextBlock}">
|
<Style x:Key="Style.TextBlock.Base" TargetType="{x:Type TextBlock}">
|
||||||
<Setter Property="SnapsToDevicePixels" Value="True"/>
|
<Setter Property="SnapsToDevicePixels" Value="True"/>
|
||||||
<Setter Property="FontSize" Value="9pt"/>
|
<Setter Property="FontSize" Value="9pt"/>
|
||||||
|
@ -18,6 +19,7 @@
|
||||||
<Style x:Key="Style.TextBlock.Group" TargetType="{x:Type TextBlock}" BasedOn="{x:Null}">
|
<Style x:Key="Style.TextBlock.Group" TargetType="{x:Type TextBlock}" BasedOn="{x:Null}">
|
||||||
<Setter Property="SnapsToDevicePixels" Value="True"/>
|
<Setter Property="SnapsToDevicePixels" Value="True"/>
|
||||||
<Setter Property="OverridesDefaultStyle" Value="True"/>
|
<Setter Property="OverridesDefaultStyle" Value="True"/>
|
||||||
|
<Setter Property="FontFamily" Value="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyWindow, Mode=OneWay}"/>
|
||||||
<Setter Property="Foreground" Value="{DynamicResource Brush.FG2}"/>
|
<Setter Property="Foreground" Value="{DynamicResource Brush.FG2}"/>
|
||||||
<Setter Property="FontWeight" Value="ExtraBold"/>
|
<Setter Property="FontWeight" Value="ExtraBold"/>
|
||||||
<Setter Property="FontSize" Value="9pt"/>
|
<Setter Property="FontSize" Value="9pt"/>
|
||||||
|
|
|
@ -138,14 +138,12 @@ namespace SourceGit.Views.Widgets {
|
||||||
|
|
||||||
#region EVENTS
|
#region EVENTS
|
||||||
private void LayoutTextPreview(List<Models.TextLine> lines) {
|
private void LayoutTextPreview(List<Models.TextLine> lines) {
|
||||||
var font = new FontFamily(Models.Preference.Instance.General.FontFamilyWindow);
|
|
||||||
|
|
||||||
var maxLineNumber = $"{lines.Count + 1}";
|
var maxLineNumber = $"{lines.Count + 1}";
|
||||||
var formatted = new FormattedText(
|
var formatted = new FormattedText(
|
||||||
maxLineNumber,
|
maxLineNumber,
|
||||||
CultureInfo.CurrentCulture,
|
CultureInfo.CurrentCulture,
|
||||||
FlowDirection.LeftToRight,
|
FlowDirection.LeftToRight,
|
||||||
new Typeface(font, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal),
|
new Typeface(txtPreviewData.FontFamily, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal),
|
||||||
12.0,
|
12.0,
|
||||||
Brushes.Black,
|
Brushes.Black,
|
||||||
VisualTreeHelper.GetDpi(this).PixelsPerDip);
|
VisualTreeHelper.GetDpi(this).PixelsPerDip);
|
||||||
|
|
|
@ -10,8 +10,7 @@
|
||||||
xmlns:widgets="clr-namespace:SourceGit.Views.Widgets"
|
xmlns:widgets="clr-namespace:SourceGit.Views.Widgets"
|
||||||
xmlns:validations="clr-namespace:SourceGit.Views.Validations"
|
xmlns:validations="clr-namespace:SourceGit.Views.Validations"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800"
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
FontFamily="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}">
|
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<converter:BoolToCollapsed x:Key="BoolToCollapsed"/>
|
<converter:BoolToCollapsed x:Key="BoolToCollapsed"/>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
|
|
Loading…
Reference in a new issue