Click here to Skip to main content
15,877,103 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I can't simply set the x:Name attribute of the ComboBox because there are more than one. I also don't know how to get a specific ComboBox from code, to set/get the Text property.
Here is a simplified version of my XAML file:

<pre lang="XML">
    <!-- its Page because i'm using Kaxaml -->
    <XmlDataProvider x:Key="PropertyData" XPath="/properties">
                <!-- This is actually in an external xml file -->
                    <properties xmlns="">
                        <property name="some property">
                            <item value="5"  />
                            <item value="10"  />
                            <item value="15"  />
                            <item value="20"  />
                        <property name="other property">
                            <item value="5"  />
                            <item value="10"  />
                            <item value="15"  />
                            <item value="20"  />
  <ListView  DataContext="{StaticResource PropertyData}" ItemsSource="{Binding XPath=property}">
        <GridViewColumn Header="Property" DisplayMemberBinding="{Binding XPath=@name}" />
        <GridViewColumn Header="Value">
              <ComboBox Width="100" ItemsSource="{Binding XPath=item}"  DisplayMemberPath="@value"></ComboBox>

Ok, if you can solve this you get the genius label. Thanks in advance...

What I have tried:

I have tried to handle the Loaded event of the combo box in the code-behind file, but it works erractly. I also tried to create a dependency property for the selected item, but i don't know what to do with it.
Graeme_Grant 4-Jun-23 4:19am    
Why a ListView control? DataGrid would do a better job.

Why use an XmlDataProvider when a simple bound list would be a better choice?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900