R – WPF: Use SpellCheck On Read-Only TextBox

readonlyspell-checkingtextboxwpf

I'm looking to display text with the wavey red lines where a word is misspelt, but I only want the text to be selectable, not editable. If I set the TextBox's IsReadOnly property to True or IsEnabled to False, the wavey red lines disappear and I can't get around it by putting something transparent as this will prevent the user being able to select sections of the text.

Is there anyway I can keep the red lines, allow the text to be selectable but prevent the actual text being modified?

Thanks

Best Answer

You could hook up to on the text change event of the text box, and just reject the new text. It would have the same effect of readonly without graying out the textbox or getting rid of the spell checking.