예제 #1
0
        void OnTextChanged(object sender, Microsoft.UI.Xaml.Controls.TextChangedEventArgs textChangedEventArgs)
        {
            if (IsPassword)
            {
                // If we're not on a phone, we can just obfuscate any input
                string updatedRealText     = DetermineTextFromPassword(Text, SelectionStart, base.Text);
                string updatedText         = Obfuscate(updatedRealText);
                var    savedSelectionStart = SelectionStart;

                if (Text != updatedRealText)
                {
                    Text = updatedRealText;
                }

                if (base.Text != updatedText)
                {
                    base.Text = updatedText;
                }

                SelectionStart = savedSelectionStart;
            }
            else if (base.Text != Text)
            {
                // Not in password mode, so we just need to make the "real" text match
                // what's in the textbox; the internalChange flag keeps the TextProperty
                // synchronization from happening
                _internalChangeFlag = true;
                Text = base.Text;
                _internalChangeFlag = false;
            }
        }
예제 #2
0
 void OnNativeTextChanged(object sender, Microsoft.UI.Xaml.Controls.TextChangedEventArgs args)
 {
     if (Control.Text == _transformedText)
     {
         return;
     }
     _transformedText = Element.UpdateFormsText(Control.Text, Element.TextTransform);
     Element.SetValueCore(Entry.TextProperty, _transformedText);
 }