Could anybody share the idea how to get the last block of a RichTextBox
's document in WPF?
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).
I think this must help you:
box.Document.Blocks.Remove(box.Document.Blocks.LastBlock)