Skip to content

fixes for case adding data at the end of the textbox #3338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
11 commits merged into from
Oct 6, 2020
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;

using Windows.ApplicationModel.DataTransfer;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
Expand Down Expand Up @@ -300,7 +301,7 @@ private static void Textbox_TextChanging(TextBox textbox, TextBoxTextChangingEve
// case adding data at the end of the textbox
if (oldSelectionStart >= oldText.Length && !isDeleteOrBackspace)
{
textbox.Text = oldText;
textbox.Text = textbox.Text.Substring(0, oldText.Length);
if (oldText.Length >= 0)
{
textbox.SelectionStart = oldText.Length;
Expand All @@ -327,6 +328,7 @@ private static void Textbox_TextChanging(TextBox textbox, TextBoxTextChangingEve
if (string.IsNullOrEmpty(textbox.Text))
{
textbox.Text = displayText;
return;
}
else
{
Expand Down