[英]RichTextBox in WPF - Getting last block of text
Could anybody share the idea how to get the last block of a RichTextBox
's document in WPF? 任何人都可以分享如何在WPF中获取
RichTextBox
文档的最后一个块吗? I tried with code: 我试过代码:
Block pg = box.Document.ContentEnd.Paragraph.PreviousBlock;
box.Document.Blocks.Remove(pg);
But it doesn't work (the first line is throwing exceptions). 但它不起作用(第一行是抛出异常)。
我认为这必须对你有所帮助:
box.Document.Blocks.Remove(box.Document.Blocks.LastBlock)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.