ModernUI中的Heading2风格

时间:2017-05-11 17:49:41

标签: c# .net wpf xaml modern-ui

我们正在为我们的WPF应用程序使用ModernUI框架。我遇到过一种名为Heading2的样式,但我无法在代码中找到它,无论是XAML还是C#代码。 Heading2是否在ModernUI的某处定义?

1 个答案:

答案 0 :(得分:1)

是的,您可以在代码中引用它,如下所示:

<Window x:Class="WpfApp1.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:WpfApp1"
    mc:Ignorable="d"
    Title="MainWindow" Height="300" Width="300">
<Window.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="pack://application:,,,/FirstFloor.ModernUI;component/Assets/TextBlock.xaml" />
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Window.Resources>
<Grid>
    <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
    <TextBlock Text="Hello Heading2!" Style="{StaticResource Heading2}"></TextBlock>
    <TextBlock Text="No Heading..."></TextBlock>
    </StackPanel>
</Grid>

enter image description here