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

  • Home
  • SEARCH
  • 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 3963094
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:10:27+00:00 2026-05-20T03:10:27+00:00

Imagine I’ve got a FlowDocument like so: <FlowDocument xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation ColumnWidth=400 FontSize=14 FontFamily=Georgia Name=document> <Paragraph

  • 0

Imagine I’ve got a FlowDocument like so:

<FlowDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              ColumnWidth="400" FontSize="14" FontFamily="Georgia"
              Name="document">
    <Paragraph KeepTogether="True">
        <Run>ABC</Run>
        <Run>DEF</Run>
        <Run>GHI</Run>
    </Paragraph>
</FlowDocument>

And I load it like so:

    private void Button_Click(object sender, RoutedEventArgs e)
    {
        FileStream xamlFile = new FileStream("FlowDocument1.xaml", FileMode.Open);
        FlowDocument content = XamlReader.Load(xamlFile) as FlowDocument;
        fdReader.Document = content;
    }

What results is this:

enter image description here

While what I’d like to see is something like so:

enter image description here

but upon examining the FlowDocument in the watch window, I see that it inserts Runs between them that essentially have a space as their content, so rather than there being the 3 Inlines that I expect inside the Paragraph, there are 5.

How can I avoid those blank runs being inserted?

Note: I can’t really group those three runs into a single one, which would be the easy answer, due to the fact that they need to remain separate objects.

Ideas?


Solution: As Aaron correctly answered below, grouping the Runs all on one line fixes this issue. As an aside, this document was being built on the fly from other data (more complex than my example) and written out using an XmlWriter that had the XmlWriterSettings property Indent set to true (because it was easier to see the output rather than it all running together) – setting it to false eliminates those extra Runs when it is read in by the XamlReader.

  • 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-05-20T03:10:28+00:00Added an answer on May 20, 2026 at 3:10 am

    You can simply place all your runs on a single line…

    <FlowDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                  ColumnWidth="400" FontSize="14" FontFamily="Georgia"
                  Name="document">
        <Paragraph KeepTogether="True">
            <Run>ABC</Run><Run>DEF</Run><Run>GHI</Run>
        </Paragraph>
    </FlowDocument>
    

    You can then access each run via the InlineCollection…

    foreach (var run in ((Paragraph)content.Blocks.FirstBlock).Inlines)
    {
       //do stuff with run             
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Imagine this is my URL NSURL *theURL=[NSURL URLWithString:@http://stackoverflow.com/questions/ask]; How can i extract only: http://stackoverflow.com
Imagine a Model/Collection like: var AModel = Backbone.Model.extend({ defaults: { a: 'a string', b:
Imagine an HTML form and the jQuery library is loaded. I'd like it such
Imagine that you have a column with a bunch of fields like this: ab
imagine a table that looks like this CUST FLAG1 FLAG2 --------------------- 1234 1 0
Imagine you homebrew a custom gui framework that doesn't use windows handles (compact framework,
Imagine we have a program trying to write to a particular file, but failing.
Imagine you want to animate some object on a WinForm. You setup a timer
Imagine an object you are working with has a collection of other objects associated
Imagine the scene, you're updating some legacy Sybase code and come across a cursor.

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.