我有一个WPF Combo盒,定义如下:
<ComboBox Grid.Column="1" x:Name="cUrls" SelectedIndex="1" ItemsSource=" {Binding XPath=//data/endpoints/endpoint}" Margin="5" >
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding XPath=@name}"></TextBlock>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
窗口与XmlDocument一样:
<?xml version="1.0" encoding="utf-8" ?>
<data>
<endpoints>
<endpoint name="test">test url</endpoint>
<endpoint default="true" name="production">production url</endpoint>
</endpoints>
<requests>
<request >
...
</request>
<request >
...
</request>
</requests>
</data>
The binding works fine and the combo box shows the items "test" and "production" and I am able to pull the right URL out of the SelectedValue property.
我愿把ComboBox的<代码>中选入的Index的财产列入<endpoint>
nodefault=true的属性。
I ombo 如果是,这种表述会看上去什么? 如果不是的话,我应该做些什么?
感谢!