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