Just getting my feet wet with WPF etc, and I all ready have water to my chin..
I have a listbox with a expander control , The databinding is XML.
I want to be able to add a expander control for every thats in the XML
Any ideas?
Thanks
Code |
Code |
Code |
Code |
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Amit ChoudharyRank #145 · 15.8K reputationPosted Feb 18, 2010, 11:08 PM EST
Try tree control and populate it with your XML data. i don't know much about WPF but i'm just guessing may be it helps you..
RIck Mueller45 reputationPosted Feb 19, 2010, 6:18 AM EST
Amit ChoudharyRank #145 · 15.8K reputationPosted Feb 21, 2010, 10:07 PM EST
you can do it using ADO.Net Class DataSet. Just covert the XML file data to DataSet. In following i example i have changed the code from the article you have given. Extract data from dataset and added it to the Collection and then Create a view like in the article and bind it to the
List.
See below code.
public class Person { public string Name { get; set; } public int Age { get; set; } public string Country { get; set; } } DataSet dsPerson; ObservableCollection myList; public Window1() { InitializeComponent(); dsPerson = new DataSet(); string filePath = "Complete path where you saved the XML file"; dsPerson.ReadXml(filePath); myList = new ObservableCollection(); // Adding Content of Dataset to Collection for(int i=0;iMark the answer if it helps you.