Esempio n. 1
0
 private static void AttachEventHandlers(TextBoxBase textBox, UndoManager manager)
 {
     if (textBox != null && manager != null)
     {
         textBox.AddHandler(CommandManager.PreviewExecutedEvent, new ExecutedRoutedEventHandler(manager.ExecutedHandler), true); // we need to see all events to subvert the built-in undo/redo tracking in the text boxes
         textBox.TextChanged += new TextChangedEventHandler(manager.TextChangedHandler);
     }
 }
Esempio n. 2
0
        public static void SetSharedUndoScope(DependencyObject obj, UndoManager value)
        {
            if (obj == null) { throw new ArgumentNullException("obj"); }

            obj.SetValue(SharedUndoScopeProperty, value);
        }
Esempio n. 3
0
 private static void RemoveEventHandlers(TextBoxBase textBox, UndoManager manager)
 {
     if (textBox != null && manager != null)
     {
         textBox.RemoveHandler(CommandManager.PreviewExecutedEvent, new ExecutedRoutedEventHandler(manager.ExecutedHandler));
         textBox.TextChanged -= new TextChangedEventHandler(manager.TextChangedHandler);
     }
 }