tags:

views:

24

answers:

1

I have a xml like this:

<root>
<project name="p1">
 <row field1="31" field2="3" Name="Joe"/>
  <row field1="39" field2="3" Name="Joey"/>
  <row field1="37" field2="3" Name="Joei"/>
</project>
<project name="p2">
 <row field1="31" field2="3" Name="Joe"/>
  <row field1="39" field2="3" Name="Joey"/>
</project>
</root>

Now the listbox displays the projects. When a project is selected in listbox, a grid has to display the rows. Is it possible to do this in Xaml? Or should i do it in the code as part of listbox's selectionChanged Event?

+1  A: 
karmicpuppet
Looks great except the datasouce is hardcoded into the XAML. How could you do with an external XML file ?
David Brunelle
Yeah, I did it to make the sample easy to run. To make it work with an external XML file, simply replace the declaration of the XMLDataProvider to something like:<XmlDataProvider x:Key="data" Source="XMLFile1.xml"/>It should still work.
karmicpuppet
Thanks. Since .net framework 3.5 is what iam using, i cant use datagrid. Now if row node has multiple subrow nodes, i would have to display each value as a combobox instead of a textblock. This perhaps can be done in DataGrid with each (row,column) being a text block or a combobox, but iam not sure whats the alternative to it