aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.cs
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-06-25 18:03:20 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-06-25 18:03:20 +0300
commit50eb2f5147af4387f807872ae81dd50dfedbb86e (patch)
treec731631d80bfd0b8a8eeb7a4546f5648b9634a9f /Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.cs
parentc8890c60c3ee1d9f33606d272fdc45e6f7f5ef3f (diff)
downloadTango-50eb2f5147af4387f807872ae81dd50dfedbb86e.tar.gz
Tango-50eb2f5147af4387f807872ae81dd50dfedbb86e.zip
Working on PPC!!!
Diffstat (limited to 'Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.cs')
-rw-r--r--Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.cs22
1 files changed, 21 insertions, 1 deletions
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;
+ }
}
}
}