XAML:属性“内容”只能设置一次 - 尽管只设置一次

时间:2016-11-26 14:46:22

标签: c# wpf xaml

我正在尝试在C#XMAL WPF应用程序中设置材质设计。 我在项目中添加了"Material Design In XAML",之后我收到了以下错误:The property 'Content' can only be set once我的标记中会出现问题?我提供了以下错误的文件:

<Window x:Class="e621_fetch.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:e621_fetch"
    mc:Ignorable="d"
    Title="MainWindow" Height="350" Width="525"
    xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
    TextElement.Foreground="{DynamicResource MaterialDesignBody}"
    TextElement.FontWeight="Regular"
    TextElement.FontSize="13"
    TextOptions.TextFormattingMode="Ideal"
    TextOptions.TextRenderingMode="Auto"
    Background="{DynamicResource MaterialDesignPaper}"
    FontFamily="{DynamicResource MaterialDesignFont}">
<Grid>
    <materialDesign:Card Padding="32" Margin="16"> //error on this line
              
        <TextBlock Style="{DynamicResource MaterialDesignTitleTextBlock}">My First Material Design App</TextBlock> //error on this line
            
    </materialDesign:Card> //error on this line
</Grid>

1 个答案:

答案 0 :(得分:0)

已经修好了,这是因为标签之间有空白......