/// <summary>
        /// Creates a new TextAreaDefaultInputHandler instance.
        /// </summary>
        public TextAreaDefaultInputHandler(TextArea textArea)
            : base(textArea)
        {
            this.NestedInputHandlers.Add(CaretNavigation = CaretNavigationCommandHandler.Create(textArea));
            this.NestedInputHandlers.Add(Editing = EditingCommandHandler.Create(textArea));
            this.NestedInputHandlers.Add(MouseSelection = new SelectionMouseHandler(textArea));

            this.CommandBindings.Add(new CommandBinding(ApplicationCommands.Undo, ExecuteUndo, CanExecuteUndo));
            this.CommandBindings.Add(new CommandBinding(ApplicationCommands.Redo, ExecuteRedo, CanExecuteRedo));
        }
示例#2
0
        private static void OnLostMouseCapture(object sender, MouseEventArgs e)
        {
            TextArea textArea = (TextArea)sender;

            if (Mouse.Captured != textArea)
            {
                SelectionMouseHandler handler = textArea.DefaultInputHandler.MouseSelection as SelectionMouseHandler;
                if (handler != null)
                {
                    handler.mode = MouseSelectionMode.None;
                }
            }
        }