Example #1
0
        /// <summary>
        /// Implementation of Freezable.CloneCurrentValueCore()
        /// </summary>
        protected override void CloneCurrentValueCore(Freezable source)
        {
            base.CloneCurrentValueCore(source);

            FreezableCollection <T> sourceFreezableCollection = (FreezableCollection <T>)source;

            CloneCommon(sourceFreezableCollection, CloneCommonType.CloneCurrentValue);
        }
Example #2
0
        /// <summary>
        /// Implementation of Freezable.GetCurrentValueAsFrozenCore()
        /// </summary>
        protected override void GetCurrentValueAsFrozenCore(Freezable source)
        {
            base.GetCurrentValueAsFrozenCore(source);

            FreezableCollection <T> sourceFreezableCollection = (FreezableCollection <T>)source;

            CloneCommon(sourceFreezableCollection, CloneCommonType.GetCurrentValueAsFrozen);
        }
Example #3
0
        public VisualStateGroup()
        {
            States = new FreezableCollection <VisualState>();
            States.TrySetContextParent(this);

            Transitions = new FreezableCollection <VisualTransition>();
            Transitions.TrySetContextParent(this);
        }
Example #4
0
        public VisualStateGroup()
        {
            States = new FreezableCollection <VisualState>();
            States.SetInheritanceParent(this);

            Transitions = new FreezableCollection <VisualTransition>();
            Transitions.SetInheritanceParent(this);
        }
Example #5
0
            internal Enumerator(FreezableCollection <T> list)
            {
                Debug.Assert(list != null, "list may not be null.");

                _list    = list;
                _version = list._version;
                _index   = -1;
                _current = default(T);
            }
Example #6
0
        private void CloneCommon(FreezableCollection <T> source,
                                 CloneCommonType cloneType)
        {
            int count = source._collection.Count;

            _collection = new List <T>(count);

            for (int i = 0; i < count; i++)
            {
                T newValue = source._collection[i];

                Freezable itemAsFreezable = newValue as Freezable;

                if (itemAsFreezable != null)
                {
                    switch (cloneType)
                    {
                    case CloneCommonType.Clone:
                        newValue = itemAsFreezable.Clone() as T;
                        break;

                    case CloneCommonType.CloneCurrentValue:
                        newValue = itemAsFreezable.CloneCurrentValue() as T;
                        break;

                    case CloneCommonType.GetAsFrozen:
                        newValue = itemAsFreezable.GetAsFrozen() as T;
                        break;

                    case CloneCommonType.GetCurrentValueAsFrozen:
                        newValue = itemAsFreezable.GetCurrentValueAsFrozen() as T;
                        break;

                    default:
                        Invariant.Assert(false, "Invalid CloneCommonType encountered.");
                        break;
                    }

                    if (newValue == null)
                    {
                        throw new InvalidOperationException(SR.Get(SRID.Freezable_CloneInvalidType, typeof(T).Name));
                    }
                }

                OnFreezablePropertyChanged(/* oldValue = */ null, newValue);
                _collection.Add(newValue);
            }
        }
Example #7
0
 public static void SetVisualStateGroups(DependencyObject obj, FreezableCollection <VisualStateGroup> value)
 {
     obj.SetValue(VisualStateGroupsProperty, value);
 }