Exemplo n.º 1
0
        public static void SwitchVisualBehavior(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            IVisualBehavior oldBehavior = e.OldValue as IVisualBehavior;

            FrameworkElement el = (FrameworkElement)d;

            if (oldBehavior != null)
            {
                oldBehavior.Detach(el);
            }

            IVisualBehavior newBehavior = e.NewValue as IVisualBehavior;

            if (newBehavior != null)
            {
                newBehavior.Attach(el);
            }
        }
Exemplo n.º 2
0
 public static void SetTheAttachedBehavior(DependencyObject obj, IVisualBehavior value)
 {
     obj.SetValue(TheAttachedBehaviorProperty, value);
 }