From 50eb2f5147af4387f807872ae81dd50dfedbb86e Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 25 Jun 2018 18:03:20 +0300 Subject: Working on PPC!!! --- .../Tango.Touch/Controls/TouchTextBox.cs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.cs') diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.cs index 8a7c907c9..b70750286 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.cs @@ -18,6 +18,8 @@ namespace Tango.Touch.Controls { public class TouchTextBox : TouchInput { + private TextBox _text_box; + public String Text { get { return (String)GetValue(TextProperty); } @@ -47,9 +49,27 @@ namespace Tango.Touch.Controls DefaultStyleKeyProperty.OverrideMetadata(typeof(TouchTextBox), new FrameworkPropertyMetadata(typeof(TouchTextBox))); } - public TouchTextBox() + public override void OnApplyTemplate() + { + base.OnApplyTemplate(); + + _text_box = GetTemplateChild("PART_TextBox") as TextBox; + + _text_box.GotFocus += _text_box_GotFocus; + } + + private async void _text_box_GotFocus(object sender, RoutedEventArgs e) { + await Task.Delay(50); + if (FocusSelectionMode == FocusSelectionMode.SelectAll) + { + _text_box.SelectAll(); + } + else if (FocusSelectionMode == FocusSelectionMode.ScrollToEnd) + { + _text_box.CaretIndex = _text_box.Text.Length; + } } } } -- cgit v1.3.1