public ThicknessAnimationUsingKeyFrames() { this.animationOperations = ThicknessAnimationOperations.Default; this.isAccumulable = true; KeyFrames = new FreezableCollection <ThicknessKeyFrame>(); KeyFrames.TrySetContextParent(this); }
public KeyFramesAnimationTimeline(IAnimationOperations <T> animationOperations, bool isAccumulable) { this.animationOperations = animationOperations; this.isAccumulable = isAccumulable; KeyFrames = new FreezableCollection <KeyFrame <T> >(); KeyFrames.TrySetContextParent(this); }
public Grid() { RowDefinitions = new FreezableCollection <RowDefinition>(); RowDefinitions.TrySetContextParent(this); ColumnDefinitions = new FreezableCollection <ColumnDefinition>(); ColumnDefinitions.TrySetContextParent(this); defaultRowDefinitions = new [] { new RowDefinition() }; defaultColumnDefinitions = new [] { new ColumnDefinition() }; }
public void FreezableCollectionBasicTest() { int resources1ChangedCount = 0; object resourceValue; Freezable freezable1 = new Freezable(); freezable1.ResourcesChanged += (sender, e) => resources1ChangedCount++; FreezableCollection <Freezable> freezableCollection = new FreezableCollection <Freezable> { freezable1 }; FrameworkElement element = new FrameworkElement(); element.Resources = new ResourceDictionary(); element.Resources.Add("key1", "value1"); Assert.IsFalse(freezable1.TryGetResource("key1", out resourceValue)); freezableCollection.TrySetContextParent(element); Assert.AreEqual(1, resources1ChangedCount); Assert.IsTrue(freezable1.TryGetResource("key1", out resourceValue)); Assert.AreEqual("value1", resourceValue); Freezable freezable2 = new Freezable(); freezableCollection.Add(freezable2); Assert.IsTrue(freezable2.TryGetResource("key1", out resourceValue)); Assert.AreEqual("value1", resourceValue); freezableCollection.Clear(); Assert.AreEqual(2, resources1ChangedCount); Assert.IsFalse(freezable1.TryGetResource("key1", out resourceValue)); Assert.IsFalse(freezable2.TryGetResource("key1", out resourceValue)); }