I need to display some data from an XML file in a list, but unsure how to exactly handle it.
The data looks like this:
<Parents>
<Parent Name="Parent1">
<Child Title="Child1" Print="Y" Active="Y" PrintPath="C:\Print" LogPath="C:\Log" />
<Child Title="Child2" Print="Y" Active="Y" PrintPath="C:\Print" LogPath="C:\Log" />
</Parent>
<Parent Name="Parent2">
<Child Title="Child1" Print="Y" Active="Y" PrintPath="C:\Print" LogPath="C:\Log" />
</Parent>
<Parent Name="Parent3">
<Child Title="Child3" Print="Y" Active="Y" PrintPath="C:\Print" LogPath="C:\Log" />
</Parent>
</Parents>
Here's how the user wants things displayed. (The ^ indicates an Expander):
^ Parent: Parent1
^ Child: Child1
Print: Y Active: Y
Print Path: C:\Print
Log Path: C:\LogPath
^ Child: Child2
Print: Y Active: Y
Print Path: C:\Print
Log Path: C:\LogPath
^ Parent: Parent2
Here are the issues:
- There can be multiple Parent elements
- There can be multiple child elements per parent
- Any parent or child can be deleted
- Any parent or child can be copied and pasted
- A new parent or child can be added
I'm thinking of solving it this way:
- Place everthing in a list box
- Put parent records in an expander
- Put a stack panel in the Parent expander
- Put child records in an expander in the stack panel and use a group box to hold the attributes
Here's what I'm not sure about:
How do I handle an unknown number of child records per parent?
How do I deal with insert/delete of child records?
I'll take any suggestions for solving this.
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer