public void AttachedProperty_CLR_FullyQualified () { // You can't specify the fully qualified object type var data = new OpacityObject (); Canvas.SetTop (data, 100); var target = new OpacityObject (); Assert.Throws<Exception> (() => { new Binding { Path = new PropertyPath ("(MoonTest.System.Windows.Data.OpacityObject.Attached)"), Source = data, }; }); }
public void AttachedProperty_CLR () { // You can't specify just the class name unless it's // been registered before somehow. Probably has to be registered // through XAML. var data = new OpacityObject (); Canvas.SetTop (data, 100); var target = new OpacityObject (); Assert.Throws<Exception> (() => { new Binding { Path = new PropertyPath ("(OpacityObject.Attached)"), Source = data, }; }); }
public void TwoWayWithStoryboard_CoreProperty () { bool complete = false; var data = new OpacityObject { Opacity = 0 }; var rect = new OpacityObject { Opacity = 0 }; rect.SetBinding (OpacityObject.OpacityProperty, new Binding { Source = data, Mode = BindingMode.TwoWay, Path = new PropertyPath ("Opacity"), }); Storyboard sb = new Storyboard (); sb.Children.Add (new DoubleAnimation { From = 0, To = 1, Duration = TimeSpan.FromMilliseconds (10) }); Storyboard.SetTarget (sb.Children [0], rect); Storyboard.SetTargetProperty (sb.Children [0], new PropertyPath ("(Opacity)")); sb.Completed += delegate { complete = true; }; sb.Begin (); EnqueueConditional (() => complete, "#1"); Enqueue (() => Assert.AreEqual (0, data.Opacity, "#2")); Enqueue (() => Assert.AreEqual (1, rect.Opacity, "#3")); EnqueueTestComplete (); }