开发者

WPF RichTextBox and '\t'

I am having trouble with adding text to the RichTextBox with tabs in it. I have code similar to this:

var documentRange = new TextRange(this.Document.ContentStart, this.Document.ContentEnd);
documentRange.Text = 开发者_如何学JAVA"";
if(this.Code != null)
  this.AppendText(this.Code);

And when I do this I can see tabs in paragraphs that start with '\t' but if I actually delete the tab then press the Tab key, the indentation is wrong. In fact it's about half the size exactly. Also if I tab in the middle of a line the tabbing is different.

Also when I pull the Text out of the TextRange lines that start with tabs appear to not generate '\t's generated by pressing the Tab key. This is incredibly frustrating. Does anyone have advice or ideas how to work with this?


The answer is that the Rich Text Box just has issues and is not good enough for advanced scenarios. Try a 3rd party or roll your own from scratch.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜