public static void SetBehaviors(DependencyObject obj, BehaviorCollection value) { if (obj == null) { throw new ArgumentNullException("obj"); } obj.SetValue(Interaction.BehaviorsProperty, value); }
public static BehaviorCollection GetBehaviors(DependencyObject obj) { if (obj == null) { throw new ArgumentNullException("obj"); } BehaviorCollection behaviorCollection = (BehaviorCollection)obj.GetValue(Interaction.BehaviorsProperty); if (behaviorCollection == null) { behaviorCollection = new BehaviorCollection(); obj.SetValue(Interaction.BehaviorsProperty, behaviorCollection); } return behaviorCollection; }
public static BehaviorCollection GetBehaviors(DependencyObject obj) { if (obj == null) { throw new ArgumentNullException("obj"); } BehaviorCollection behaviorCollection = (BehaviorCollection)obj.GetValue(Interaction.BehaviorsProperty); if (behaviorCollection == null) { behaviorCollection = new BehaviorCollection(); obj.SetValue(Interaction.BehaviorsProperty, behaviorCollection); } return(behaviorCollection); }
private static void OnBehaviorsChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args) { BehaviorCollection behaviorCollection = (BehaviorCollection)args.OldValue; BehaviorCollection behaviorCollection2 = (BehaviorCollection)args.NewValue; if (behaviorCollection == behaviorCollection2) { return; } if (behaviorCollection != null && behaviorCollection.AssociatedObject != null) { behaviorCollection.Detach(); } if (behaviorCollection2 != null && sender != null) { behaviorCollection2.Attach(sender); } }