Hi friends,
I have the following XML:
It's in memory created XML and I need to bind it to a ComboBox.
To get the students from the XML string I'm using:
In my combo, ValuePath is "ID" and MemberOath is "NAME".
Well, "You need to create a class..." you may say... but the XML data changes.
It can be Student ID, Student Name.... Student ID, Student Adress... Teacher ID, Teacher Name.... it's a very dynamic data with and ID and XYZ
How to bind this kind of XML ?
Best regards
I have the following XML:
<
NewDataSet
>
<
student
id
=
"001"
name
=
"Jonh"
/>
<
student
id
=
"002"
name
=
"Mary"
/>
<... .../>
<
NewDataSet
/>
It's in memory created XML and I need to bind it to a ComboBox.
To get the students from the XML string I'm using:
{
XElement xmlDoc;
...
xmlDoc = XElement.Parse(XMLString);
...
var myQuery = from p
in
xmlDoc.Elements(
"student"
)
select p;
...
myComboBox.ItemsSource = myQuery;
}
In my combo, ValuePath is "ID" and MemberOath is "NAME".
Well, "You need to create a class..." you may say... but the XML data changes.
It can be Student ID, Student Name.... Student ID, Student Adress... Teacher ID, Teacher Name.... it's a very dynamic data with and ID and XYZ
How to bind this kind of XML ?
Best regards