c# - WP8, DoubleAnimation - "Cannot resolve TargetName" exception -


I want to make marque effect in WP8 application. To accomplish this, I placed StackPanel inside ScrollViewer and using Double Animation on the property TranslateTransform.X I am trying to do

Code:

  & lt; Phone: phone applicationpage Resources & gt; & Lt; Storyboard x: name = "scroll" repeatEdit = "always" autoRowers = "true" & gt; & Lt; = "Double" animation for = "100" storyboard from "0" Target name = "conversion" storyboard. Target = "X" period = "0: 0: 5" /> & Lt; / Storyboard & gt; & Lt; / Phone: PhoneApplicationPage.Resources & gt; & Lt; Grid X: Name = "Layouts" & gt; ... & lt; ScrollViewer height = "80" vertical scrollbar = "disabled" horizontal ScrollBarVisibility = "hidden" & gt; & Lt; StackPanel Orientation = "Horizontal" & gt; & Lt; StackPanel.RenderTransform & gt; & Lt; Translation TRANSFORX x: name = "change" /> & Lt; /StackPanel.RenderTransform> & Lt; Image Source = "/ Property / Logo 1 page" & gt; & Lt; / Image & gt; & Lt; Image Source = "/ Property / Logo 2.png" & gt; & Lt; / Image & gt; & Lt; Image Source = "/ Property / Logo 3.png" & gt; & Lt; / Image & gt; & Lt; Image Source = "/ Property / Logo 4.png" & gt; & Lt; / Image & gt; & Lt; Image Source = "/ Property / Logo 5.png" & gt; & Lt; / Image & gt; & Lt; / StackPanel & gt; & Lt; / ScrollViewer & gt; & Lt; / Grid & gt;  

Unfortunately, Load in the event handler, the code-back from Scroll.Begin () is getting an exception. : System.InvalidOperationException: TargetName Transform can not be resolved .

What is I'am doing wrong? When I place StackPanel directly in the LayoutRoot, but the animation runs when it is a child of the ScrollViewer.

I think the exception is interpretive as if you apply the storyboard to some UI element but your xaml There is no element named "Transform" on which this storyboard will be applied.

Then this property should be the name of the Storyboard.TargetName UI element that must be changed.

In your case if you just have to give your stackpayel then MyStackPanel and then the location of transform in your storyboard code Enter this name on

  & lt; StackPanel Orientation = "horizontal" name = "MyTextPanel" & gt; & Lt; StackPanel.RenderTransform & gt; & Lt; Translation TRANSFORX x: name = "change" /> & Lt; /StackPanel.RenderTransform> ...  

You should change the storyboard in such a way ..

  & lt; Phone: PhoneApplicationPage.Resources & gt; & Lt; Storyboard x: name = "scroll" repeatEdit = "always" autoRowers = "true" & gt; & Lt; = Double Animation for = "100" Storyboard from = "0" TITLEName = "MyStackPanel" storyboard. TargetProperty = "X" Duration = "0: 0: 5" /> & Lt; / Storyboard & gt; & Lt; / Phone: PhoneApplicationPage.Resources & gt;  Important : - If you use Blend to create simple animation then it will be much better and see how the animation code in page Xaml is generated. is. You will find all your answers :) 


Comments