static SelectableTextBlock()
        {
            FocusableProperty.OverrideMetadata(typeof(SelectableTextBlock), new FrameworkPropertyMetadata(true));
            TextEditorWrapper.RegisterCommandHandlers(typeof(SelectableTextBlock), true, true, true);

            // remove the focus rectangle around the control
            FocusVisualStyleProperty.OverrideMetadata(typeof(SelectableTextBlock), new FrameworkPropertyMetadata((object?)null));
        }
        public static TextEditorWrapper CreateFor(TextBlock tb)
        {
            _ = tb ?? throw new ArgumentNullException(nameof(tb));
            var textContainer = TextContainerProp.GetValue(tb) ?? throw new InvalidOperationException("Cannot get value of TextContainerProp");

            var editor = new TextEditorWrapper(textContainer, tb, false);

            IsReadOnlyProp.SetValue(editor._editor, true);
            TextViewProp.SetValue(editor._editor, TextContainerTextViewProp.GetValue(textContainer));

            return(editor);
        }
 public SelectableTextBlock()
 {
     TextEditorWrapper.CreateFor(this);
 }