为什么这个XAML失败了;“财产”;内容“;只能设置一次;?

为什么这个XAML失败了;“财产”;内容“;只能设置一次;?,xaml,winrt-xaml,uielement,flyout,kaxaml,Xaml,Winrt Xaml,Uielement,Flyout,Kaxaml,我有这个XAML: <AppBarButton Icon="Protected" Label="Privacy Policy" > <AppBarButton.Flyout> <StackPanel> <Flyout> <TextBlock Text="Photrax extracts information from images you load into it. The i

我有这个XAML:

<AppBarButton Icon="Protected" Label="Privacy Policy" >
    <AppBarButton.Flyout>
        <StackPanel>
        <Flyout>
            <TextBlock Text="Photrax extracts information from images you load into it. The information it extracts includes location information (where the photos were taken, when that is available) and the date and time the photo was taken. This data is stored in a local/internal/embedded (SQLite) database. This data is not stored in the cloud but only on your local device." TextWrapping="Wrap" FontSize="26" FontFamily="Verdana">
            </TextBlock>
            <TextBlock Text="To reiterate: Your data is not shared with anyone else. It is stored only on the device from which you use Photrax." TextWrapping="Wrap" FontSize="26" FontFamily="Verdana">
            </TextBlock>
        </Flyout>
        </StackPanel>
    </AppBarButton.Flyout>
</AppBarButton>

…失败,因为“属性”内容“只能设置一次。”

当以下基本相同的XAML可以很好地编译时,为什么会出现这样的问题:

<AppBarButton Icon="MapPin" Label="Colors In Use" Tapped="appbarbtnPhotosetColorMapping_Tapped">
    <AppBarButton.Flyout>
        <Flyout>
            <StackPanel Background="Azure">
                <TextBlock Text="Photoset:Pushpin Color Legend" TextWrapping="Wrap" FontSize="26" FontFamily="Verdana"></TextBlock>
                <TextBlock x:Name="textblock0" Text="Unused" Foreground="Red" FontFamily="Segoe UI" FontSize="13" Margin="4" />

?

我也有其他关于xaml的错误MSG(关于预期的以下类型:flyoutbase和uielement),但我认为是内容业务给了我业务

我将问题代码粘贴到kaxaml中,但它甚至不知道AppBarButton是什么,并抱怨它是无效元素

更新 我还不能测试它,但我认为阿卜杜拉的意思是我需要改变这一点:

<StackPanel>
<Flyout>
  . . .
</Flyout>
</StackPanel>

. . .
……为此:

<Flyout>
<StackPanel>
. . .
</StackPanel>
</Flyout>

. . .

这里有两个问题:

1) 属性“内容”只能设置一次。

您不能多次设置
的内容,您可以在第一个XAML代码中设置两次内容(两个文本块),在工作XAML代码中设置一次内容(一个StackPanel),具体如下:


单元素
单元素:

声明内容的单个对象元素。这一定是一个错误 对象的层次结构中包含UIElement(普通字符串不起作用)。 这可以是一个容器,例如面板派生类,以便 弹出按钮中的多个内容项可以在布局中排列

2) 应为以下类型:“飞出基地”。


不能将弹出型按钮属性设置为非从类派生的任何类(即仅弹出型按钮和菜单项)。您可以在第一个XAML代码中将弹出属性设置为StackPanel,并在工作XAML中将弹出属性设置为弹出属性。

但是您可以看到,我有这样做的代码,工作正常。工作XAML和有问题的XAML之间有什么区别?是的,我在我的回答中指出了区别:有问题的XAML(您设置了两次内容并将弹出属性设置为StackPanel)和工作XAML(您设置了一次内容并将弹出属性设置为弹出属性),没错!即使没有stackpanel,我也有问题;我加上它是为了修复它。好的,我想你说的是将StackPanel移动到弹出框内;现在看来很明显。我试试看。
<Flyout>
    singleUIElement
</Flyout>