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; } } }
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; } } } }