I messed around with some digging in the Metro XAML app. I need to create code Storyboard. I would like to install Storyboard.TargetPropertyonCompositeTransform.Rotation
Seems impossible ...
My storyboard in XAML looks like this:
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.Rotation)" Storyboard.TargetName="grid">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="60"/
</DoubleAnimationUsingKeyFrames>
</Storyboard>
I would like to create something similar.
Important: I am not trying to recreate this accurate storyboard. I am inside custom code ContentControl, therefore thisit is Control, and there is no “grid” for the target animation. The goal is the control itself, which was previously set CompositeTransform.
My code so far looks like this:
var turnSB = new Storyboard();
var doubleAnim = new DoubleAnimationUsingKeyFrames();
doubleAnim.KeyFrames.Add(new EasingDoubleKeyFrame() { KeyTime = TimeSpan.FromMilliseconds(0), Value = currentAngle });
doubleAnim.KeyFrames.Add(new EasingDoubleKeyFrame() { KeyTime = TimeSpan.FromMilliseconds(500), Value = targetAngle });
turnSB.Children.Add(doubleAnim);
Storyboard.SetTarget(doubleAnim, this.RenderTransform);
Storyboard.SetTargetProperty(doubleAnim, "(CompositeTransform.Rotation)");
turnSB.Begin();
Begin, , (CompositeTransform.Rotation). , . , PropertyPaths , ?: S
, ...
EDIT:
, . , ...
UserControl, . , Storyboard.Target, .
, (, ContentControl), Storyboard , .
: ( XAML) ( , ) , . , , Opacity, .
( UserControl, .)
- ?