按钮单击时,在段落中迭代地突出显示文本部分

时间:2015-01-09 10:06:30

标签: c# wpf flowdocument

我在XAML文件中跟随了段落的FlowDocument:

<FlowDocumentScrollViewer ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto">
    <FlowDocument Name="fDocument" PagePadding="10" FontFamily="Segoe UI" FontSize="22">
        <Paragraph Name="fdParagraph">
            Those who have denied the reality of moral distinctions, may be
            ranked among the disingenuous disputants; nor is it conceivable,
            that any human creature could ever seriously believe, that all
            characters and actions were alike entitled to the affection and
            regard of everyone. The difference, which nature has placed
            between one man and another, is so wide, and this difference is
            still so much farther widened, by education, example, and habit,
            that, where the opposite extremes come at once under our
            apprehension, there is no scepticism so scrupulous, and scarce
            any assurance so determined, as absolutely to deny all
            distinction between them. Let a man's insensibility be ever so
            great, he must often be touched with the images of Right and
            Wrong; and let his prejudices be ever so obstinate, he must
            observe, that others are susceptible of like impressions. The
            only way, therefore, of converting an antagonist of this kind, is
            to leave him to himself.
        </Paragraph>
    </FlowDocument>
</FlowDocumentScrollViewer>

基本上,我想要实现的是在每次点击时突出显示下一个文本部分。例如:

  

点击 - &gt;那些

     

点击 - &gt;谁

     

点击 - &gt;有

据我所知,我首先需要将此段拆分为文本部分,用空格字符拆分,然后将部分存储到数组中,但我不知道Paragraph类中的哪些方法可以帮助我实现这一点

那么,如何突出显示段落中的下一个文本部分?

0 个答案:

没有答案