public void ResolveManagedPropertyPath2() { MiscParsingTestAnimation page = new MiscParsingTestAnimation("/moon-unit;component/misc/Parsing/MiscParsingAnimation.xaml"); Storyboard s = (Storyboard)page.FindName("the_storyboard"); HalfDimensionsControl control = (HalfDimensionsControl)page.FindName("the_control"); DoubleAnimation the_animation = (DoubleAnimation)page.FindName("the_animation"); s.Begin(); Enqueue(() => Assert.AreEqual(25, control.HalfHeight, "#1")); // Make sure the path isn't magically expanded by the parser Enqueue(() => Assert.AreEqual("(moon:HalfDimensionsControl.HalfHeight)", Storyboard.GetTargetProperty(the_animation).Path, "#2")); // Try setting the path programmatically (reset it first) Enqueue(() => s.Stop()); Enqueue(() => Storyboard.SetTargetProperty(the_animation, new PropertyPath("Height"))); Enqueue(() => s.Begin()); Enqueue(() => Assert.AreEqual(25, control.Height, "#3")); Enqueue(() => s.Stop()); Enqueue(() => Storyboard.SetTargetProperty(the_animation, new PropertyPath("(moon:HalfDimensionsControl.HalfWidth)"))); Enqueue(() => s.Begin()); Enqueue(() => Assert.AreEqual(25, control.HalfWidth, "#4")); Enqueue(() => s.Stop()); Enqueue(() => Storyboard.SetTargetProperty(the_animation, new PropertyPath("(monkey:HalfDimensionsControl.HalfHeight)"))); Enqueue(() => s.Begin()); Enqueue(() => Assert.AreEqual(25, control.HalfHeight, "#5")); EnqueueTestComplete(); }
public void ResolveManagedPropertyPathInCode() { MiscParsingTestAnimation page = new MiscParsingTestAnimation("/moon-unit;component/misc/Parsing/MiscParsingAnimation.xaml"); Storyboard s = (Storyboard)page.FindName("the_storyboard"); HalfDimensionsControl control = (HalfDimensionsControl)page.FindName("the_control"); DoubleAnimation the_animation = new DoubleAnimation(); the_animation.Duration = new Duration(new TimeSpan(0)); the_animation.To = 25; s.Children.Clear(); s.Children.Add(the_animation); Storyboard.SetTarget(the_animation, control); Storyboard.SetTargetProperty(the_animation, new PropertyPath("(moon:HalfDimensionsControl.HalfHeight)")); Enqueue(() => s.Begin()); Enqueue(() => Assert.AreEqual(25, control.HalfHeight, "#1")); EnqueueTestComplete(); }