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 8805529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:53:29+00:00 2026-06-14T01:53:29+00:00

I am using a quite simple Tree Structure: class Tree { } class Node

  • 0

I am using a quite simple Tree Structure:

class Tree { }
class Node : Tree {
    public List <Tree> Children;
}
class Leave : Tree {
    public string Content;
}

And I want to display it in a WPF – RichTextBox, the Result look something like that, but bound to my Tree:

<FlowDocument>
  <Section>
    <Paragraph>
      TEXT_FOOTER
    </Paragraph>
  </Section>
</FlowDocument>

Where only the leaves of the tree display their Content in a Paragraph, and Nodes display in a Section.

Currently I am solving this Programmatically, but to keep the RTB in Sync with my Tree is a Hard piece of work.
Is there way to bind such a structure to the Box, I know that the Document-Property is not a Dependency Property, so no binding.

I came over this TextBox: Here, But i am not shure if and how I can bind it, wpf does not seem to Know a HierachicalDataTemplate at this point.
Is there any way to make wpf take my synchronisation work?

  • 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-14T01:53:30+00:00Added an answer on June 14, 2026 at 1:53 am

    I finally kind of solved it. The Problem is: WPF does not give me ANY possibilities to use DataBinding, so I wrote around using the “onTextElementChanged” and text.Selection.Start.Parent to recieve the Run the cursor was in.
    My corresponding Datastructure i wanted to Map was stored in the “Tag”-Property of the parent Paragraph. I know its quite a ugly solution, but it was the only one that worked Properly.

    If something changes, I had to concatinate multiple Runs, due the RTB splits them at random to write the changes back. Thats why I took the Paragraph to store it.

    The other direction could be solved by listening to the PropertyChanged events, just like the WPF presents it to you.

    The biggest an still unsolvable issue is the undo functionality of the RTB. Because I had to build a more complex Data structure, I used some UserControls and InlineUIContainer. If you remove one of them (for example by pressing “entf”) the programm crashes with a StackOverflowException. It is a “undocumented Feature” or bug in the WPF, and Microsoft does not bother to fix it.

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

Sidebar

Related Questions

the Membership Provider ValidateUser using EF is quite simple public override bool ValidateUser(string username,
This is the (quite simple) JS code I'm using: $(document).ready(function() { $(.button-list .next).click(function() {
In Ubuntu it's quite simple; I can run the application using: $ NODE_ENV=production node
I'm trying to save a simple (but quite big) Tree structure into a binary
I just gave an answer to a quite simple question by using an extension
I'm working on a quite simple Webpage (MVC2), using localisation based on Resource Files.
I am currently using Jsoup to parse a html. The code is quite simple:
I trying to create a pipe using C#. The code is quite simple but
I have a written a very simple UDP Server using Netty - it quite
Using Apache, it is quite simple to set up a page that uses basic

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.