예제 #1
0
        public ThicknessAnimationUsingKeyFrames()
        {
            this.animationOperations = ThicknessAnimationOperations.Default;
            this.isAccumulable       = true;

            KeyFrames = new FreezableCollection <ThicknessKeyFrame>();
            KeyFrames.TrySetContextParent(this);
        }
예제 #2
0
        public KeyFramesAnimationTimeline(IAnimationOperations <T> animationOperations, bool isAccumulable)
        {
            this.animationOperations = animationOperations;
            this.isAccumulable       = isAccumulable;

            KeyFrames = new FreezableCollection <KeyFrame <T> >();
            KeyFrames.TrySetContextParent(this);
        }
예제 #3
0
파일: Grid.cs 프로젝트: will8886/Granular
        public Grid()
        {
            RowDefinitions = new FreezableCollection <RowDefinition>();
            RowDefinitions.TrySetContextParent(this);

            ColumnDefinitions = new FreezableCollection <ColumnDefinition>();
            ColumnDefinitions.TrySetContextParent(this);

            defaultRowDefinitions    = new [] { new RowDefinition() };
            defaultColumnDefinitions = new [] { new ColumnDefinition() };
        }
예제 #4
0
        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));
        }