Xaml “成员”;背景“;无法识别或无法访问

Xaml “成员”;背景“;无法识别或无法访问,xaml,windows-runtime,textblock,Xaml,Windows Runtime,Textblock,我是XAML新手,正在尝试为TextBlock定义样式。在MSDN上找到了如何设置样式的示例(在第一个代码块中) 我的XAML是: <Page x:Name="pageRoot" x:Class="MyPrototype.MainPage" DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}" xmlns="http://schemas.microsoft

我是XAML新手,正在尝试为TextBlock定义样式。在MSDN上找到了如何设置样式的示例(在第一个代码块中)

我的XAML是:

<Page
    x:Name="pageRoot"
    x:Class="MyPrototype.MainPage"
    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:MyPrototype"
    xmlns:common="using:MyPrototype.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

<Page.Resources>
    <!-- TODO: Delete this line if the key AppName is declared in App.xaml -->
    <x:String x:Key="AppName">MyPrototype</x:String>
    <x:String x:Key="AppTitle">MyPrototype</x:String>


    <Style TargetType="TextBlock" x:Key="TitleTextBlockStyle">
        <Setter Property="Background" Value="Red"/>
        <Setter Property="FontFamily" Value="Trebuchet MS"/>
        <Setter Property="Foreground" Value="White" />
        <Setter Property="FontSize" Value="18"/>
    </Style>
</Page.Resources>

<StackPanel Orientation="Horizontal" >
<TextBlock Style="{StaticResource TitleTextBlockStyle}" Text="My Prototype Main Page"/>
</StackPanel>

我的原型
我的原型

我收到错误“会员”背景“无法识别或无法访问”,我不明白为什么。我猜是语法错误,但我一辈子都看不出它是什么。

这适用于您的应用程序类型


在这种情况下,
TextBlock
没有
Background
属性。

TextBlock
没有背景property@thumbmunkeys我上面链接的MSDN页面是否不适用于Windows 8 Metro应用程序?显然不适用,请参阅我的回答谢谢。我一直在MSDN中挣扎。