Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9137829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:10:39+00:00 2026-06-17T09:10:39+00:00

I am working with FlowDocuments in a RichTextBox, more specifically with TextRanges and TextPointers

  • 0

I am working with FlowDocuments in a RichTextBox, more specifically with TextRanges and TextPointers when TextChange Events occur.

I am accessing the TextRange through

TextChange change;  
TextRange range = new TextRange(RichTextControl.Document.ContentStart, RichtextControl.Document.ContentEnd);
TextRange changeRange = new TextRange(range.Start.GetPositionAtOffset(change.Offset), range.Start.GetPositionAtOffset(change.Offset+change.AddedLength));

The TextRange I have to work with spans over multiple Paragraphs. The TextRange I extract from the selection, simplified, looks like this:

<Section>
  <Paragraph>
    <Span>
      <Run>Test1</Run>
    </Span>
  </Paragraph>
  <Paragraph>
    <Span>
      <Run>Test2</Run>
    </Span>
  </Paragraph>
</Section>

I can now access the first Paragraph my using TextRange.Start. I can traverse this paragraph normally through accessing Inlines.

However, as soon as I want to access the SECOND paragraph I’m somewhat out of options. I can see TextPointer.GetNextContextPosition, but that would lead to me hopping over the Textpointer Offset positions until the Context the pointer is in changes, which, I hope, just can’t be the way to do this.

I don’t know if I am just doing it wrong to actually capture the changed text, or if I am just missing the right Interface to traverse all Paragraphs contained in the Section. If so, the solution should be easy, but I just can’t see it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:10:40+00:00Added an answer on June 17, 2026 at 9:10 am

    I seemed to have lacked the proper search terms to find the solution. I found something that might be usable here http://www.bryanewert.net/journal/2010/5/26/how-to-explore-the-contents-of-a-flowdocument.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Working through more book examples- this one is a partial poker program- This segment
I am working with a FlowDocument in a WPF RichTextBox . Some of the
Working through C++ Primer Plus and am trying to cin data to a dynamically
Working through Pro ASP.NET MVC book and I got the following code snippet that
Working through rubykoans.com I came across these two pieces of code in about_array_assignment.rb How
Working through this for fun: http://www.diku.dk/hjemmesider/ansatte/torbenm/Basics/ Example calculation of nullable and first uses a
Working on a project that parses a log of events, and then updates a
Working on a small game using an HTML5 canvas, and javascript. And it's working
Working with an undisclosed API, I found a function that can set the number
Working with Reporting Services 2008 r2. So here's my issue: We have 5 reports

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.