I would like to use the latest version (beta10.5) to achieve a simple animation, but it was unsuccessful. The process is painful, the recording process is as follows:
The following is a simple animation code, this code has been tested in Silverlight is working.
(Note that the following code is in Silverlight
Code: Select all
<UserControl.Resources>
<Storyboard x:Name="Dong1" >
<DoubleAnimation From="0" To="200" Duration="0:0:5" Storyboard.TargetName="rec1" Storyboard.TargetProperty="(Canvas.Left)" RepeatBehavior="Forever"></DoubleAnimation>
</Storyboard>
</UserControl.Resources>
<Canvas x:Name="LayoutRoot" Background="White">
<Rectangle Width="100" Height="100" Canvas.Left="0" Canvas.Top="30" Fill="Yellow" x:Name="rec1">
</Rectangle>
</Canvas>
Then we use the following code to open the animation, it can work:
Code: Select all
public MainPage()
{
InitializeComponent();
this.Loaded += MainPage_Loaded;
}
private void MainPage_Loaded(object sender, RoutedEventArgs e)
{
Dong1.Begin();
}
Below I use the "Silverlight Migration Edition", the code is as follows:
Code: Select all
<Page.Resources>
<Storyboard x:Name="Dong1" >
<DoubleAnimation From="0" To="200" Duration="0:0:5" Storyboard.TargetName="rec1" Storyboard.TargetProperty="(Canvas.Left)" ></DoubleAnimation>
</Storyboard>
</Page.Resources>
<Canvas x:Name="LayoutRoot" Background="White">
<Rectangle Width="100" Height="100" Canvas.Left="0" Canvas.Top="30" Fill="Yellow" x:Name="rec1">
</Rectangle>
</Canvas>
However, it can not compile successfully. Such as the screenshot below:
Look at the situation, it is a namespace problem.
So, I do not use the "Silverlight Migration Edition", but the first direct use of cshtml5 empty project to create, with the above code, it can compile successfully!
But I am happy too early, although the translation was successful, but it can not function properly, being given as follows:
After repeated checks, the problem should be in the properties of the animation, Storyboard.TargetProperty = "(Canvas.Left)" It does not work. I try to use Opacity as the animation property, which is working fine!
To give you trouble,
Best Regards,
Tomny