Browse Source

Merge pull request #10 from xamldude/master

Small changes to text selection for the TextBox
pull/12/head
Steven Kirk 12 years ago
parent
commit
86df78eabb
  1. 9
      Perspex.Controls/TextBox.cs
  2. 3
      Perspex.Controls/TextBoxView.cs

9
Perspex.Controls/TextBox.cs

@ -256,7 +256,6 @@ namespace Perspex.Controls
return false; return false;
} }
} }
private void OnKeyDown(object sender, KeyEventArgs e) private void OnKeyDown(object sender, KeyEventArgs e)
{ {
string text = this.Text ?? string.Empty; string text = this.Text ?? string.Empty;
@ -267,6 +266,14 @@ namespace Perspex.Controls
switch (e.Key) switch (e.Key)
{ {
case Key.A:
if (modifiers == ModifierKeys.Control)
{
this.SelectionStart = 0;
this.SelectionEnd = this.Text.Length;
}
break;
case Key.Left: case Key.Left:
this.MoveHorizontal(-1, modifiers); this.MoveHorizontal(-1, modifiers);
movement = true; movement = true;

3
Perspex.Controls/TextBoxView.cs

@ -55,6 +55,9 @@ namespace Perspex.Controls
public new void LostFocus() public new void LostFocus()
{ {
this.parent.SelectionStart = 0;
this.parent.SelectionEnd = 0;
this.caretTimer.Stop(); this.caretTimer.Stop();
this.InvalidateVisual(); this.InvalidateVisual();
} }

Loading…
Cancel
Save