Example #1
0
        private static void CommandProperty_Changed(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
        {
            Control element = dependencyObject as Control;

            if (element != null)
            {
                MouseMoveBehavior behavior = GetOrCreateBehavior(element);
                behavior.Command = e.NewValue as ICommand;
            }
        }
Example #2
0
        private static MouseMoveBehavior GetOrCreateBehavior(Control element)
        {
            MouseMoveBehavior behavior = element.GetValue(MouseMoveBehaviorProperty) as MouseMoveBehavior;

            if (behavior == null)
            {
                behavior = new MouseMoveBehavior(element);
                element.SetValue(MouseMoveBehaviorProperty, behavior);
            }

            return(behavior);
        }
Example #3
0
 public static void SetMouseMoveBehavior(DependencyObject obj,
                                         MouseMoveBehavior value)
 {
     obj.SetValue(MouseMoveBehaviorProperty, value);
 }