I bind a XML document in a WPF window. The xml doc looks like this:
<root>
<common>
... more stuff
<logSeverityLevel>Debug</logSeverityLevel>
...
</common>
<collections>
<logSeverityLevels>
<logSeverityLevel>Debug</logSeverityLevel>
<logSeverityLevel>Info</logSeverityLevel>
<logSeverityLevel>Trace</logSeverityLevel>
<logSeverityLevel>Error</logSeverityLevel>
<logSeverityLevel>Fatal</logSeverityLevel>
</logSeverityLevels>
</collections>
</root>
And the the bindings:
<WrapPanel FlowDirection="LeftToRight" DataContext="{Binding XPath=/root/common}">
<DockPanel>
<TextBlock Text="Log Severity Level : " />
<ComboBox SelectedItem="{Binding XPath=logSeverityLevel}" ItemsSource="{Binding XPath=/root/collections/logSeverityLevels/*}" />
</DockPanel>
</WrapPanel>
Now when I run the program, I can see that the ComboBox is getting populated with the possible items. But it does not set Debug as the selected value. What to do about this?
No comments:
Post a Comment