Storyboard to animate usercontrol throws exception: Cannot resolve TargetName
-
Thursday, May 10, 2012 4:33 PM
Hello,
I'm trying to perform an animation for my usercontrol. The Xaml is:
<Grid>
<Grid.Resources> <Storyboard x:Name="predefinedColorPicerkMoveIn"> <DoubleAnimation Storyboard.TargetName="ucTranslation" Storyboard.TargetProperty="Y" Duration="0:0:1" To="-160" EnableDependentAnimation="True" /> </Storyboard> </Grid.Resources> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition Width="150" /> <ColumnDefinition/> </Grid.ColumnDefinitions> <StackPanel Orientation="Horizontal"/> <StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Center"> <Button x:Name="btnIncreasePageSize" HorizontalAlignment="Center" Click="HandleBtnIncreasePageSizeClick" > <Image Source="ms-appx:/Assets/Icons/PageDownIncrease.png" /> </Button> </StackPanel> <StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,20,0"> <Grid> <Button x:Name="btnForegroundColor" Background="{Binding ForegroundColor}" Click="HandleBtnForegroundColorClick" > XYZ </Button> <uc:ThemeColorChooser x:Name="ucThemeColorChooser" Margin="-90,-460,90,0"> <uc:ThemeColorChooser.RenderTransform> <TranslateTransform x:Name="ucTranslation" Y="0" /> </uc:ThemeColorChooser.RenderTransform> </uc:ThemeColorChooser> </Grid> </StackPanel> </Grid>
when in the code behind
private void HandleBtnForegroundColorClick(object sender, RoutedEventArgs e) { this.predefinedColorPicerkMoveIn.Begin(); }an exception gets thrown saying: "Additional information: Cannot resolve TargetName ucTranslation."
I don't have any idea why this happens.
Appreciated for any help.
Thanks.
Philipp
All Replies
-
Thursday, May 10, 2012 8:41 PMModeratorIt looks like you're storyboarding the transition inside the control, not the control itself.
Matt Small - Microsoft Escalation Engineer - Forum Moderator If my reply answers your question, please mark this post as answered.
-
Friday, May 11, 2012 8:18 AM
It looks like you're storyboarding the transition inside the control, not the control itself.
Matt Small - Microsoft Escalation Engineer - Forum Moderator If my reply answers your question, please mark this post as answered.
Yes, because I want to animate the transition. Isn't this possible?
According to this (german) blog post http://blogs.msdn.com/b/windowsappdev_de/archive/2012/05/04/schnelle-und-fl-252-ssige-animationen-f-252-r-apps-im-metro-stil.aspx this should be no problem (code in section "Beispiel für eine benutzerdefinierte XAML-Animation")
Did i miss something essential in that article?
- Edited by Paiden36 Friday, May 11, 2012 8:19 AM
-
Friday, May 11, 2012 6:55 PMModeratorI'm researching this.
Matt Small - Microsoft Escalation Engineer - Forum Moderator If my reply answers your question, please mark this post as answered.
-
Monday, May 14, 2012 3:16 PMModeratorI'm not getting that problem. Can you send me your application? MSMALL at Microsoft.
Matt Small - Microsoft Escalation Engineer - Forum Moderator
If my reply answers your question, please mark this post as answered. -
Tuesday, May 15, 2012 5:00 AMSent you an example application.
-
Tuesday, May 15, 2012 7:09 PMModeratorI can't find it in my email - I even checked the junk folder. Can you resend it please?
Matt Small - Microsoft Escalation Engineer - Forum Moderator
If my reply answers your question, please mark this post as answered. -
Tuesday, May 15, 2012 10:53 PM
Try something like this if you want to animate a Control using Translate Transform. You should be able to convert this to your implementation quite easily
<Page x:Class="Application58.BlankPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:Application58" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> <Page.Resources> <Storyboard x:Name="Storyboard1"> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="button"> <SplineDoubleKeyFrame KeyTime="0:0:0.9" Value="234"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="button"> <SplineDoubleKeyFrame KeyTime="0:0:0.9" Value="-18"/> </DoubleAnimationUsingKeyFrames> </Storyboard> </Page.Resources> <Grid Background="{StaticResource ApplicationPageBackgroundBrush}"> <Button x:Name="button" Content="Button" HorizontalAlignment="Left" Height="72" Margin="205,246,0,0" VerticalAlignment="Top" Width="171" RenderTransformOrigin="0.5,0.5"> <Button.RenderTransform> <CompositeTransform/> </Button.RenderTransform> </Button> </Grid> </Page>
Dev@Mic
- Edited by Harikrishna MenonMicrosoft Employee Tuesday, May 15, 2012 10:53 PM
- Proposed As Answer by Harikrishna MenonMicrosoft Employee Tuesday, May 15, 2012 10:54 PM
- Marked As Answer by Paiden36 Wednesday, May 16, 2012 4:17 PM
-
Wednesday, May 16, 2012 6:46 AM
Sent the email again. Additionally the app can be downloaded from:
https://skydrive.live.com/redir.aspx?cid=fdda0bc0aa4709ed&resid=FDDA0BC0AA4709ED!376&parid=FDDA0BC0AA4709ED!375
Instructions:
- Open in Visual Sutdio
- Compile
- Run
- Click "Test" Button
- Exception will be thrown (At least on my Machine with W8 ConsumerPreview + VS11 Ultimate Beta)
Best regards,
Philipp
-
Wednesday, May 16, 2012 1:31 PMModeratorDoes Harikrishna's proposal work to resolve this problem?
Matt Small - Microsoft Escalation Engineer - Forum Moderator
If my reply answers your question, please mark this post as answered. -
Wednesday, May 16, 2012 4:17 PMYes it works.


