How to get the current line (and remove) in WPF's RichTextBox? There is no usefull functions such as RichTextBox.GetLineFromCharIndex() in WinForms.
Thanks in advance.
C.H.
You can get a paragraph by calling Paragraph para=CaretPosition.Paragraph;
If you want to remove this paragraph, use Document.Blocks.Remove(para). if you want to remove the line in which the Caret is, you should find two TextPointers: The one at the begining of the line and the one at the end. Call these two tp1 and tp2. You can remove the line by
TextRange tr=new textRange(tp1,tp2);
tr.Text="";
If I've understood correctly, let me know to explain how you can get the two TextPointers