public void OnKeyPress(UIKeyEventArgs e) { this.SetCaretState(true); //------------------------ if (e.IsControlCharacter) { OnKeyDown(e); return; } char c = e.KeyChar; e.CancelBubbling = true; if (internalTextLayerController.SelectionRange != null && internalTextLayerController.SelectionRange.IsValid) { InvalidateGraphicLocalArea(this, GetSelectionUpdateArea()); } bool preventDefault = false; if (textSurfaceEventListener != null && !(preventDefault = TextSurfaceEventListener.NotifyPreviewKeydown(textSurfaceEventListener, c))) { internalTextLayerController.UpdateSelectionRange(); } if (preventDefault) { return; } if (internalTextLayerController.SelectionRange != null) { internalTextLayerController.AddCharToCurrentLine(c); if (textSurfaceEventListener != null) { TextSurfaceEventListener.NotifyCharactersReplaced(textSurfaceEventListener, e.KeyChar); } } else { internalTextLayerController.AddCharToCurrentLine(c); if (textSurfaceEventListener != null) { TextSurfaceEventListener.NotifyCharacterAdded(textSurfaceEventListener, e.KeyChar); } } EnsureCaretVisible(); if (textSurfaceEventListener != null) { TextSurfaceEventListener.NotifyKeyDown(textSurfaceEventListener, e.KeyCode); } }
public void DoTab() { if (internalTextLayerController.SelectionRange != null) { InvalidateGraphicLocalArea(this, GetSelectionUpdateArea()); } internalTextLayerController.AddCharToCurrentLine(' '); internalTextLayerController.AddCharToCurrentLine(' '); internalTextLayerController.AddCharToCurrentLine(' '); internalTextLayerController.AddCharToCurrentLine(' '); internalTextLayerController.AddCharToCurrentLine(' '); if (textSurfaceEventListener != null) { TextSurfaceEventListener.NotifyCharacterAdded(textSurfaceEventListener, '\t'); } InvalidateGraphicOfCurrentLineArea(); }