I have a WPF canvas on which I'm dynamically creating objects from the code. These objects are changing by setting the RenderTransform property, and the animation needs to apply one of those changes. Currently, I can not get the property of any change to animate (although no exception is raised and the animation appears to be running - the event which is completed) is picked up.
In addition, if the animation system is emphasized, then the storyboard.
All instances of animate XAML changes have come up. I suggest that X: the name change properties should be set to be animatable, but I have no work to set it up with code The way to do is not found.
Any thoughts?
Here is the complete code list that reproduces the problem:
using the system; Using System.Diagnostics; Using System.Windows; Using System.Windows.Controls; Using System.Windows.Input; System.Windows.Media; Using System.Windows.Media.Animation; Using System.Windows.Shapes; Namespace AnimationSupport Test {/// & lt; Summary & gt; /// MainWindow.xaml for Interaction Logic /// & lt; / Summary & gt; Public Partial Class Main Window: Window {Canvas Panel; Public Manvindo () {Initialization (); MouseDown + = DawnAnnik Animation; Content = panel = new canvas (); } Zero DoDynamicAnimation (Object Sender, MouseButtonEventArgs Args) {for (int i = 0; i & lt; 12; ++ i) {var e = new oval {width = 16, height = 16, fill = SystemColors.HighlightBrush}; Canvas.Set lift (E, mouse gapeption (this) .X); Canvas Sat Top (e, mouse gapeption (it).); Var tg = new transform group (); Var Translation = New Translation Transformers (30, 0); Tg.children.Add (translation); Tg.Children.Add (New RotateTransform (i * 30)); E.RenderTransform = TG; Panel.Children.Add (e); Var s = new storyboard (); Storyboard सर्टिगेट (एस, अनुवाद); Storyboard Settlepacpete (S, New Propertypath (Translation Transform. Exproporty); S.Children.Add (new double animation (3, 100, new duration (new timespan (0, 0, 0, 1, 0)) {ease = new powerage {easying = easingMode.EaseOut}}); S.Completed + = (sndr, evtArgs) = & gt; {Debug.WriteLine ("Animation {0} full {1}", s.GetHashCode (), stopwatch. GetTimestamp ()); Panel.Children.Remove (E); }; Debug.lightline ("animation {0} {1}" started, s.GetHashCode (), stopwatch. GetTimestamp ()); S.Begin (); }} [STAThread] Public static zero main () {var app = new application (); App Moves (new main window); }}}}
Release the storyboard:
< Code> WORK T = new translation transformer (40, 0); Duration = new duration (new timespan (0, 0, 0, 1, 0)); Double animation animation = new double animation (30, duration); T.BeginAnimation (Translation Transform. YProperty, Anime);
(Small Fix for Syntax)
Comments
Post a Comment