Ejemplo 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);
     }
 }
Ejemplo n.º 2
0
        public static void SetSharedUndoScope(DependencyObject obj, UndoManager value)
        {
            if (obj == null) { throw new ArgumentNullException("obj"); }

            obj.SetValue(SharedUndoScopeProperty, value);
        }
Ejemplo 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);
     }
 }