Folks,
I was able to bind my ComboBox to an XML file, but there’s a “small cosmetic” problem. The data in the XML file looks like this:
But the ComboBox displays it all in one item: 4800960019200Code:<?xml version="1.0" encoding="UTF-8"?> <Options> <BaudRates> <BaudRate>4800</BaudRate> <BaudRate>9600</BaudRate> <BaudRate>19200</BaudRate> </BaudRates> </Options>
The binding is done entirely in XAML:
How can I display each XML item as a separate ComboBox item?Code:<ComboBox Name="cboBaudRate" Grid.Column="1" Grid.Row="1" Margin="0,2,0,0" HorizontalAlignment="Left" Width="72" Height="20" VerticalAlignment="Top" > <ComboBox.ItemsSource> <Binding Source="{StaticResource SerialPortOptions}" XPath="./BaudRates" /> </ComboBox.ItemsSource> </ComboBox>
Of course, I can post more snippets if needed.
Thanks,
- Nick





Reply With Quote
