locked
Cannot resolve TargetProperty (UIElement.Projection)(PlaneProjection.RotationY) on specified object. RRS feed

  • Question

  • I want to flip a Grid in my UserControl but the animation doesn't work

    First approach:

    XAML

    <UserControl.Resources>
            <Storyboard x:Name="flipping">
                <DoubleAnimation Duration="0:0:5" From="0" To="180" Storyboard.TargetName="content" Storyboard.TargetProperty="(UIElement.Projection)(PlaneProjection.RotationY)"/>
            </Storyboard>
    </UserControl.Resources>
    
    <Grid x:Name="content">
            <Grid.Projection>
                <PlaneProjection/>
            </Grid.Projection>
            ...
    </Grid>
        

    Code behind:

    flipping.Begin();

    throws an Exception:

    Cannot resolve TargetProperty (UIElement.Projection)(PlaneProjection.RotationY) on specified object.


    Second approach:

    content.Projection = new PlaneProjection();
    
    var pointedStoryboard = new Storyboard();
    var doubleAnnimationX = new DoubleAnimation();
    doubleAnnimationX.Duration = TimeSpan.FromMilliseconds(500);
    doubleAnnimationX.To = 2;
    
    pointedStoryboard.Children.Add(doubleAnnimationX);
    Storyboard.SetTarget(doubleAnnimationX, content);
    Storyboard.SetTargetProperty(doubleAnnimationX, "(UIElement.Projection).(PlaneProjection.RotationY)");
    
    pointedStoryboard.Begin();

    Same error

    Translating and Scaling using this code works without any issues.

    Can anyone help me ?







    • Edited by hppDev Wednesday, September 11, 2013 12:11 PM
    Wednesday, September 11, 2013 11:19 AM

Answers

  • Hi, hppDev

    Try to change your XAML like below:

    <UserControl.Resources>
            <Storyboard x:Name="flipping">
                <DoubleAnimation Duration="0:0:5" From="0" To="180" Storyboard.TargetName="content" Storyboard.TargetProperty="RotationY"/>
            </Storyboard>
    </UserControl.Resources>
    
    <Grid>
            <Grid.Projection>
                <PlaneProjection RotationY="0" x:Name="content"/>
            </Grid.Projection>
            ...
        </Grid>
    

    Best Wishes!




    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by hppDev Thursday, September 12, 2013 1:35 PM
    Thursday, September 12, 2013 7:21 AM

All replies

  • Hi, hppDev

    Try to change your XAML like below:

    <UserControl.Resources>
            <Storyboard x:Name="flipping">
                <DoubleAnimation Duration="0:0:5" From="0" To="180" Storyboard.TargetName="content" Storyboard.TargetProperty="RotationY"/>
            </Storyboard>
    </UserControl.Resources>
    
    <Grid>
            <Grid.Projection>
                <PlaneProjection RotationY="0" x:Name="content"/>
            </Grid.Projection>
            ...
        </Grid>
    

    Best Wishes!




    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by hppDev Thursday, September 12, 2013 1:35 PM
    Thursday, September 12, 2013 7:21 AM
  • Thanks for the help, it worked.

    Thursday, September 12, 2013 5:49 PM