superpuccio
superpuccio

Reputation: 12972

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

I'm very new to xaml and I get this error when I try to run my Universal App:

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.

Until now, I'v only edited the MainPage.xaml file (not the c# classes) and this is the xaml (very simple) file:

<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>

I'm trying to rotate an image after a button click. I know that it's a famous question, but I can't understand where I'm wrong. Thank you.

Upvotes: 2

Views: 1008

Answers (1)

Heena
Heena

Reputation: 8634

In winrt EventTrigger will not support other events and it works for only loaded event.Check this link..hence it is not working for RoutedEvent="Button.Click" .

Upvotes: 2

Related Questions