Browse Source

Merge pull request #10 from xamldude/master

Small changes to text selection for the TextBox
pull/12/head
Steven Kirk 11 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;
}
}
private void OnKeyDown(object sender, KeyEventArgs e)
{
string text = this.Text ?? string.Empty;
@ -267,6 +266,14 @@ namespace Perspex.Controls
switch (e.Key)
{
case Key.A:
if (modifiers == ModifierKeys.Control)
{
this.SelectionStart = 0;
this.SelectionEnd = this.Text.Length;
}
break;
case Key.Left:
this.MoveHorizontal(-1, modifiers);
movement = true;

3
Perspex.Controls/TextBoxView.cs

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

Loading…
Cancel
Save