Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        public static TextEditorWrapper CreateFor(TextBlock tb)
        {
            var textContainer = TextContainerProp.GetValue(tb);

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

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

            return(editor);
        }
Exemplo n.º 3
0
        public SelectableTextBlock()
        {
            _editor = TextEditorWrapper.CreateFor(this);

            this.Loaded += (sender, args) => {
                this.Dispatcher.UnhandledException -= Dispatcher_UnhandledException;
                this.Dispatcher.UnhandledException += Dispatcher_UnhandledException;
            };
            this.Unloaded += (sender, args) => {
                this.Dispatcher.UnhandledException -= Dispatcher_UnhandledException;
            };
        }