月更
This commit is contained in:
41
AntDesignWPF/Controls/Heading/Heading.cs
Normal file
41
AntDesignWPF/Controls/Heading/Heading.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
namespace AntDesignWPF.Controls
|
||||
{
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
/// <summary>
|
||||
/// A heading of the a page.
|
||||
/// </summary>
|
||||
public class Heading : TextBlock
|
||||
{
|
||||
#region Properties
|
||||
|
||||
public static readonly DependencyProperty SizeProperty =
|
||||
DependencyProperty.Register("Size", typeof(HeadingSizes), typeof(Heading), new PropertyMetadata(HeadingSizes.Normal));
|
||||
|
||||
/// <summary>
|
||||
/// Gets/sets the size of the heading.
|
||||
/// </summary>
|
||||
public HeadingSizes Size
|
||||
{
|
||||
get { return (HeadingSizes)GetValue(SizeProperty); }
|
||||
set { SetValue(SizeProperty, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
static Heading()
|
||||
{
|
||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(Heading), new FrameworkPropertyMetadata(typeof(Heading)));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public enum HeadingSizes : byte
|
||||
{
|
||||
ExtraLarge, Large, Medium, Normal, Small, Tiny
|
||||
}
|
||||
}
|
||||
42
AntDesignWPF/Controls/Heading/Heading.xaml
Normal file
42
AntDesignWPF/Controls/Heading/Heading.xaml
Normal file
@@ -0,0 +1,42 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:controls="clr-namespace:AntDesignWPF.Controls"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<Style TargetType="{x:Type controls:Heading}">
|
||||
<Setter Property="FontSize" Value="16" />
|
||||
<Setter Property="LineHeight" Value="24" />
|
||||
<Setter Property="FontWeight" Value="Medium" />
|
||||
<Setter Property="LineStackingStrategy" Value="BlockLineHeight" />
|
||||
<Setter Property="FontFamily" Value="{DynamicResource FontFamily}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource AntDesign.Brush.TextPrimary}" />
|
||||
<Style.Triggers>
|
||||
<!-- H1 -->
|
||||
<Trigger Property="Size" Value="ExtraLarge">
|
||||
<Setter Property="FontSize" Value="30" />
|
||||
<Setter Property="LineHeight" Value="38" />
|
||||
</Trigger>
|
||||
<!-- H2 -->
|
||||
<Trigger Property="Size" Value="Large">
|
||||
<Setter Property="FontSize" Value="24" />
|
||||
<Setter Property="LineHeight" Value="32" />
|
||||
</Trigger>
|
||||
<!-- H3 -->
|
||||
<Trigger Property="Size" Value="Medium">
|
||||
<Setter Property="FontSize" Value="18" />
|
||||
<Setter Property="LineHeight" Value="26" />
|
||||
</Trigger>
|
||||
<!-- H5 -->
|
||||
<Trigger Property="Size" Value="Small">
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
<Setter Property="LineHeight" Value="22" />
|
||||
</Trigger>
|
||||
<!-- H6 -->
|
||||
<Trigger Property="Size" Value="Tiny">
|
||||
<Setter Property="FontSize" Value="12" />
|
||||
<Setter Property="LineHeight" Value="20" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
Reference in New Issue
Block a user