How to select an Item from a combobox filled from an XML file?

I have a ComboBox, filled from an XML file:

<?xml version="1.0" encoding="utf-8"?> <Configuration Version="1.5"> <Materials>    <Material PartMat="1.15" LongName="Aluminium, ε &gt;=5%" ShortName="Alge5" />    <Material PartMat="1.3" LongName="Aluminium, ε&lt;=5%" ShortName="Alle5 />    .... and some more... </Materials>  .... etc   <UserControl.Resources>     <XmlDataProvider x:Key="Config" Source="ConfigData.xml" XPath="//Materials"/> </UserControl.Resources> <ComboBox     DisplayMemberPath="@ShortName"                      ItemsSource="{Binding Source={StaticResource Config} ,XPath=*}"                 SelectedIndex="0"     SelectedValue="{Binding Path=...., Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"     SelectionChanged="MaterialComboBox_SelectionChanged"/> 

The pull-down list shows correctly.

However, What goes into the Path of SelectedValue?

And what type is that Property? An XmlNode, a string or indeed a Material? No: no string, no Material, no XmlNode, i think/found.

Asked on July 16, 2020 in XML.
Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.