简体   繁体   中英

WPF RichTextBox - Parent element from caret position

Consider this document structure:

<FlowDocument><Paragraph>loreM Ipsum</Paragraph></FlowDocument>

And my caret position is between 'M' and 'I' in the RichTextBox. How can I get the parent element from caret position? In this case the parent would be the Paragraph.

RichTextBox.CaretPosition.Parent

我认为在这种情况下,父元素实际上将是Run,而Run的父元素将是Paragraph。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM