I have an XML file that I want to display in the form of a collapsible table in WPF.
<?xml version="1.0" encoding="utf-8"?>
<TestSet>
<Test TestName="Create Contact" Result="Passed">
<Step>
<StepNumber>1</StepNumber>
<StepName>Start Pivotal</StepName>
<Result>Passed</Result>
<Comment>Attached to existing instance of Pivotal</Comment>
</Step>
<Step>
<StepNumber>2</StepNumber>
<StepName>Click on element</StepName>
<Result>Passed</Result>
<Comment>Clicked on Pivotal element [contacts tab]</Comment>
</Step>
</Test>
<Test TestName="Create Contact" Result="Passed">
<Step>
<StepNumber>1</StepNumber>
<StepName>Start Pivotal</StepName>
<Result>Passed</Result>
<Comment>Attached to existing instance of Pivotal</Comment>
</Step>
<Step>
<StepNumber>2</StepNumber>
<StepName>Click on element</StepName>
<Result>Passed</Result>
<Comment>Clicked on Pivotal element [contacts tab]</Comment>
</Step>
</Test>
</TestSet>
When I read this into a DataSet I get two tables, Table[0] which contains 2 Tests, and Table1 with 4 Steps and both tables are linked with a relationship of "TestId" that is generated by the data reader.
What I need is to display a table with the contents of Table[0] that has expandable [+] indicators, and when expanded, the relational values from Table1 is displayed underneath the row.
I have tried all sorts of solutions with DataGrid's and CollectionViewSource but haven't been able to get this to work. Can anyone help me piece this together? Have I taken the wrong approach by creating a DataSet from the XML first?
Note that the columns of each table are different (except the keys). Here is an example of what it might look like: