I'm using WPF with net 3.5 to load the ItemsSource of a combo box from an
xml file.
The xml is setup like this:
<profiles>
<profile>
<profilename>Fi rst profile</profilename>
...
</profile>
... other profile nodes
</profiles>
In the Windows.Resourc es node of the xaml I have:
<XmlDataProvide r x:Key="xmldata" Source="c:/temp/xmlData.xml"
XPath="profiles/profile" />
and in the combobox I have:
<ComboBox Margin="5" Name="cbProfile s" Width="240" IsEditable="Tru e"
ToolTip="Select database profile"
VerticalContent Alignment="Cent er"
ItemsSource="{B inding Source={StaticR esource xmldata},
XPath=profilena me }" SelectedIndex=" 0" />
But this only retreives the first profile-profilename for the combobox list.
If I change the XPath of the combobox to //profilename, then I get them all.
What am I not understanding about how this works since I think the XPath of
the XmlDataProvider should be providing a list of <profiles/profilenodes
and then the XPath of the combobox should give me all the <profilename>
nodes.
Regards,
Rick
xml file.
The xml is setup like this:
<profiles>
<profile>
<profilename>Fi rst profile</profilename>
...
</profile>
... other profile nodes
</profiles>
In the Windows.Resourc es node of the xaml I have:
<XmlDataProvide r x:Key="xmldata" Source="c:/temp/xmlData.xml"
XPath="profiles/profile" />
and in the combobox I have:
<ComboBox Margin="5" Name="cbProfile s" Width="240" IsEditable="Tru e"
ToolTip="Select database profile"
VerticalContent Alignment="Cent er"
ItemsSource="{B inding Source={StaticR esource xmldata},
XPath=profilena me }" SelectedIndex=" 0" />
But this only retreives the first profile-profilename for the combobox list.
If I change the XPath of the combobox to //profilename, then I get them all.
What am I not understanding about how this works since I think the XPath of
the XmlDataProvider should be providing a list of <profiles/profilenodes
and then the XPath of the combobox should give me all the <profilename>
nodes.
Regards,
Rick
Comment