WinRT 信息:无法分配给 属性“%0”

WinRT information: Failed to assign to property '%0'

我是 xaml 的新手,当我尝试 运行 我的通用应用程序时遇到此错误:

An exception of type 'Windows.UI.Xaml.Markup.XamlParseException' occurred in RotateThemeAll.WindowsPhone.exe but was not handled in user code

WinRT information: Failed to assign to property '%0'. [Line: 28 Position: 31]

Additional information: The text associated with this error code could not be found.

到目前为止,我只编辑了 MainPage.xaml 文件(不是 c# 类),这是 xaml(非常简单)文件:

<Page
    x:Class="RotateThemeAll.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:RotateThemeAll"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">    

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="100" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>

        <Image Grid.Row="0" Grid.Column="0" Source="Assets/spoon.gif" RenderTransformOrigin="0.5, 0.5">
            <Image.RenderTransform>
                <RotateTransform x:Name="AnimatedRotateTransform" Angle="0" />
            </Image.RenderTransform>

        </Image>
        <Button Grid.Row="1" Grid.Column="0" Content="Click">
            <Button.Triggers>
                <EventTrigger RoutedEvent="Button.Click">
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="AnimatedRotateTransform" 
                                                     Storyboard.TargetProperty="Angle" 
                                                     From="0"        
                                                     To="360" 
                                                     Duration="0:0:0.5" 
                                                     RepeatBehavior="Forever" />
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </Button.Triggers>
        </Button>
    </Grid>
</Page>

我正在尝试在单击按钮后旋转图像。我知道这是一个著名的问题,但我不明白我错在哪里。谢谢你。

在 winrt 中,EventTrigger 将不支持其他事件,它仅适用于 加载的事件。检查这个 link..因此它不适用于 RoutedEvent="Button.Click" .