コード例 #1
0
        private void UpdateTextBoxViewReadOnly()
        {
            if (_textBoxView == null)
            {
                return;
            }

            // Both IsReadOnly = true and IsTabStop = false make the control
            // not receive any input.
            var isReadOnly = IsReadOnly || !IsTabStop;

            _textBoxView.Focusable            = !isReadOnly;
            _textBoxView.FocusableInTouchMode = !isReadOnly;
            _textBoxView.Clickable            = !isReadOnly;
            _textBoxView.LongClickable        = !isReadOnly;
            _textBoxView.SetCursorVisible(!isReadOnly);

            if (isReadOnly)
            {
                _listener = _textBoxView.KeyListener;
                _textBoxView.KeyListener = null;
            }
            else
            {
                if (_listener != null)
                {
                    _textBoxView.KeyListener = _listener;
                }
            }
        }
コード例 #2
0
        partial void OnIsReadonlyChangedPartial(DependencyPropertyChangedEventArgs e)
        {
            if (_textBoxView != null)
            {
                var isReadOnly = IsReadOnly;

                _textBoxView.Focusable            = !isReadOnly;
                _textBoxView.FocusableInTouchMode = !isReadOnly;
                _textBoxView.Clickable            = !isReadOnly;
                _textBoxView.LongClickable        = !isReadOnly;
                _textBoxView.SetCursorVisible(!isReadOnly);

                if (isReadOnly)
                {
                    _listener = _textBoxView.KeyListener;
                    _textBoxView.KeyListener = null;
                }
                else
                {
                    if (_listener != null)
                    {
                        _textBoxView.KeyListener = _listener;
                    }
                }
            }
        }