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