private static void CommandProperty_Changed(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e) { var element = dependencyObject as FrameworkElement; if (element != null) { DropBehavior behavior = GetOrCreateBehavior(element); behavior.Command = e.NewValue as ICommand; } }
private static DropBehavior GetOrCreateBehavior(FrameworkElement element) { DropBehavior behavior = element.GetValue(DropBehaviorProperty) as DropBehavior; if (behavior == null) { behavior = new DropBehavior(element); element.SetValue(DropBehaviorProperty, behavior); } return(behavior); }
public static void SetDropBehavior(DependencyObject obj, DropBehavior value) { obj.SetValue(DropBehaviorProperty, value); }