【发布时间】:2010-07-26 17:38:04
【问题描述】:
我在 WPF 中有一个这样的组合框:
<ComboBox Text="Select Language..." IsEditable="True" IsReadOnly="True"
ItemsSource="{Binding XPath=item/@name, Source={StaticResource Items}}"
SelectedItem="{Binding Path=Test, Mode=OneWayToSource}"/>
项目在哪里:
<XmlDataProvider x:Key="Items" Source="/itemlist.xml" XPath="/itemlist"/>
Test 是 ViewModel 上对象类型的属性,设置为窗口的数据上下文。
一切正常,我的 Test 属性接收 XmlNode 对象,这是有道理的。
但是,我想从该 xml 接收不同的属性,例如 XPath=item/@value
我该怎么做?
【问题讨论】:
标签: wpf data-binding combobox selecteditem