Problem mimicking text box of VS output window using WPF text box

In the Visual Studio output window, you can put your text at the end of the output so that the text field scrolls automatically when new text is written. And when the carriage does not end, it will not scroll down. I would like to emulate this using the WPF text box.

I was able to do this, but only if the TextBox is not read-only. This is because I need a caret and no one is displayed when you have a read-only text field.

The problem is that the text field is editable (with copy / cut / paste and enter commands), but I don't want to.

Is there a clean solution? I would prefer not to lock all the keys, since I have CommandBindings that should work when the TextBox is focused.

thanks

+6
wpf readonly textbox
source share
2 answers

Apparently, enough people had the same problem as for adding a property just for this problem. If you can configure your project to use .NET 4.0, the TextBox has the new IsReadOnlyCaretVisible property.

+4
source share

I assume that you will not bypass the TextBox sublimation and will not block the entire keyboard, which will change the text.

0
source share

All Articles