private static CanvasDragDropBehavior GetAttachedBehavior(Canvas canvas) { if (!instances.ContainsKey(canvas)) { instances[canvas] = new CanvasDragDropBehavior(); instances[canvas].AssociatedObject = canvas; } return(instances[canvas]); }
private static CanvasDragDropBehavior GetAttachedBehavior(Canvas canvas) { if (!instances.ContainsKey(canvas)) { instances[canvas] = new CanvasDragDropBehavior(); instances[canvas].AssociatedObject = canvas; } return instances[canvas]; }
public static void SetIsEnabled(DependencyObject obj, bool value) { CanvasDragDropBehavior behavior = GetAttachedBehavior(obj as Canvas); behavior.AssociatedObject = obj as Canvas; if (value) { behavior.Initialize(); } else { behavior.CleanUp(); } obj.SetValue(IsEnabledProperty, value); }