Esempio n. 1
0
        // Token: 0x0600006F RID: 111 RVA: 0x00003528 File Offset: 0x00001728
        public static BehaviorCollection GetBehaviors(DependencyObject obj)
        {
            BehaviorCollection behaviorCollection = (BehaviorCollection)obj.GetValue(Interaction.BehaviorsProperty);

            if (behaviorCollection == null)
            {
                behaviorCollection = new BehaviorCollection();
                obj.SetValue(Interaction.BehaviorsProperty, behaviorCollection);
            }
            return(behaviorCollection);
        }
Esempio n. 2
0
        // Token: 0x06000070 RID: 112 RVA: 0x0000355C File Offset: 0x0000175C
        private static void OnBehaviorsChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
        {
            BehaviorCollection behaviorCollection  = (BehaviorCollection)args.OldValue;
            BehaviorCollection behaviorCollection2 = (BehaviorCollection)args.NewValue;

            if (behaviorCollection != behaviorCollection2)
            {
                if (behaviorCollection != null && ((IAttachedObject)behaviorCollection).AssociatedObject != null)
                {
                    behaviorCollection.Detach();
                }
                if (behaviorCollection2 != null && obj != null)
                {
                    if (((IAttachedObject)behaviorCollection2).AssociatedObject != null)
                    {
                        throw new InvalidOperationException(ExceptionStringTable.CannotHostBehaviorCollectionMultipleTimesExceptionMessage);
                    }
                    behaviorCollection2.Attach(obj);
                }
            }
        }