コード例 #1
0
        private void UpdateInputScope(InputScope inputScope)
        {
            if (_textBoxView != null)
            {
                var inputType = InputScopeHelper.ConvertInputScope(inputScope ?? InputScope);

                inputType = InputScopeHelper.ConvertToCapitalization(inputType, inputScope ?? InputScope);

                if (!IsSpellCheckEnabled)
                {
                    inputType = InputScopeHelper.ConvertToRemoveSuggestions(inputType, ShouldForceDisableSpellCheck);
                }

                if (AcceptsReturn)
                {
                    inputType |= InputTypes.TextFlagMultiLine;
                }

                if (IsReadOnly)
                {
                    inputType = InputTypes.Null;
                }

                _textBoxView.InputType = inputType;
            }
        }
コード例 #2
0
ファイル: TextBox.iOS.cs プロジェクト: nepronen/Uno
        partial void OnInputScopeChangedPartial(DependencyPropertyChangedEventArgs e)
        {
            this.CoerceValue(ReturnKeyTypeProperty);

            if (_textBoxView != null)
            {
                _textBoxView.KeyboardType = InputScopeHelper.ConvertInputScopeToKeyboardType((InputScope)e.NewValue);

                //If SpellCheck is enabled we already set the Capitalization.
                if (!IsSpellCheckEnabled)
                {
                    _textBoxView.AutocapitalizationType = InputScopeHelper.ConvertInputScopeToCapitalization((InputScope)e.NewValue);
                }
            }
        }
コード例 #3
0
        private InputTypes AdjustInputTypes(InputTypes inputType, InputScope inputScope)
        {
            inputType = InputScopeHelper.ConvertToCapitalization(inputType, inputScope);

            if (!IsSpellCheckEnabled)
            {
                inputType = InputScopeHelper.ConvertToRemoveSuggestions(inputType, ShouldForceDisableSpellCheck);
            }

            if (AcceptsReturn)
            {
                inputType |= InputTypes.TextFlagMultiLine;
            }

            return(inputType);
        }
コード例 #4
0
        private void UpdateInputScope(InputScope inputScope)
        {
            if (_textBoxView != null)
            {
                var inputType = InputScopeHelper.ConvertInputScope(inputScope);
                inputType = AdjustInputTypes(inputType, inputScope);

                if (FeatureConfiguration.TextBox.UseLegacyInputScope)
                {
                    _textBoxView.InputType = inputType;
                }
                else
                {
                    // InputScopes like multi-line works on Android only for InputType property, not SetRawInputType.
                    // For CurrencyAmount (and others), both works but there is a behavioral difference documented in UseLegacyInputScope.
                    // The behavior that matches UWP is achieved by SetRawInputType.
                    _textBoxView.InputType = AdjustInputTypes(InputTypes.ClassText, inputScope);
                    _textBoxView.SetRawInputType(inputType);
                }
            }
        }
コード例 #5
0
ファイル: TextBox.Android.cs プロジェクト: sonnemaf/uno
        private void UpdateInputScope(InputScope inputScope)
        {
            if (_textBoxView != null)
            {
                var inputType = InputScopeHelper.ConvertInputScope(inputScope ?? InputScope);

                inputType = InputScopeHelper.ConvertToCapitalization(inputType, inputScope ?? InputScope);

                if (!IsSpellCheckEnabled)
                {
                    inputType = InputScopeHelper.ConvertToRemoveSuggestions(inputType, ShouldForceDisableSpellCheck);
                }

                if (AcceptsReturn)
                {
                    inputType |= InputTypes.TextFlagMultiLine;
                }

                if (IsReadOnly)
                {
                    _textBoxView.InputType = InputTypes.Null;

                    // Clear the listener so the inputs have no effect.
                    // Setting the input type to InputTypes.Null is not enough.
                    _listener = _textBoxView.KeyListener;
                    _textBoxView.KeyListener = null;
                }
                else
                {
                    if (_listener != null)
                    {
                        _textBoxView.KeyListener = _listener;
                    }

                    _textBoxView.InputType = inputType;
                }
            }
        }