Bidirektionale Bindung von XML-Daten an WPF TreeView

Ich versuche meine umzuschreibenForestPad Anwendung mit WPF für die Präsentationsebene. In WinForms bevölkere ich jeden Knoten programmgesteuert, möchte jedoch nach Möglichkeit die Datenbindungsfunktionen von WPF nutzen.

Was ist im Allgemeinen die beste Methode, um die WPF-Strukturansicht in zwei Richtungen an ein XML-Dokument zu binden?

Eine generische Lösung ist in Ordnung, aber als Referenz sieht die Struktur des XML-Dokuments, an das ich binden möchte, folgendermaßen aus:

<?xml version="1.0" encoding="utf-8"?>
<forestPad
    guid="6c9325de-dfbe-4878-9d91-1a9f1a7696b0"
    created="5/14/2004 1:05:10 AM"
    updated="5/14/2004 1:07:41 AM">
<forest 
    name="A forest node"
    guid="b441a196-7468-47c8-a010-7ff83429a37b"
    created="01/01/2003 1:00:00 AM"
    updated="5/14/2004 1:06:15 AM">
    <data>
    <![CDATA[A forest node
        This is the text of the forest node.]]>
    </data>
    <tree
        name="A tree node"
        guid="768eae66-e9df-4999-b950-01fa9be1a5cf"
        created="5/14/2004 1:05:38 AM"
        updated="5/14/2004 1:06:11 AM">
        <data>
        <![CDATA[A tree node
            This is the text of the tree node.]]>
        </data>
        <branch
            name="A branch node"
            guid="be4b0993-d4e4-4249-8aa5-fa9c940ae2be"
            created="5/14/2004 1:06:00 AM"
            updated="5/14/2004 1:06:24 AM">
            <data>
            <![CDATA[A branch node
                This is the text of the branch node.]]></data>
                <leaf
                name="A leaf node"
                guid="9c76ff4e-3ae2-450e-b1d2-232b687214aa"
                created="5/14/2004 1:06:26 AM"
                updated="5/14/2004 1:06:38 AM">
                <data>
                <![CDATA[A leaf node
                    This is the text of the leaf node.]]>
                </data>
            </leaf>
        </branch>
    </tree>
</forest>
</forestPad>

Antworten auf die Frage(2)

Ihre Antwort auf die Frage