Binding Combobox to XML (wpf)
- by mortor
<EssenceList>
<Essence GUID="464">
<Properties>
<Property Name="Name">
<value>mt-1232-1. (1-1-3)</value>
</Property>
</Properties>
<Characteristics>
<Characteristic GUID="78">
<value>gadget</value>
</Characteristic>
<Characteristic GUID="79">
<value>measures</value>
</Characteristic>
</Characteristics>
<LinkedEssences>
<LinkType Type="ObjGroup">
<LinkedEssence GUID="369" />
</LinkType>
<LinkType Type="ObjGroupProp" />
<LinkType Type="RoleObject">
<LinkedEssence GUID="5747"/>
</LinkType>
</LinkedEssences>
</Essence>
...
<Essence GUID="5747" Type="Role">
<Properties>
<Property Name="Name">
<value>????-22</value>
</Property>
<Property Name="ShortName">
<value>UKPG-22</value>
</Property>
<Property Name="TagPrefix">
<value>UKPG22</value>
</Property>
<Property Name="useParentTagPrefix">
<value>0</value>
</Property>
</Properties>
</Essence>
...
<Essence GUID="5748" Type="Role">
</Essence>
...
in example is a xml file with data from database. now i need to bind it to some fields...
i use the XMLDataProvider here
<Grid.DataContext>
<XmlDataProvider x:Name="dataxml" XPath="EssenceList/Essence" Source="464.xml"/>
</Grid.DataContext>
and mostof simple texboxes i bind like
<TextBox Text="{Binding XPath=/EssenceList/Essence/LinkedEssences/LinkType[1]/LinkedEssence/@GUID}" />
but now i need to bind a combobox this way:
- the first Essence in the document contains LinkedEssences, that contains and
- in document below there is a full description for it that contains the NAME property i need
????-22
UKPG22
0
and many other available Essences for this combobox
i managed to bind the list of thems to combobox
<ComboBox ItemTemplate="{StaticResource rolelistTemplate}" ItemsSource="{Binding XPath=/EssenceList/Essence[@Type]}" />
so it displays it well, but i can't bind it to my LinkedEssences.