Hello,
I have the following code:
if (cboxCategory.SelectedIndex == 1)
{
cboxSubcategory.IsEnabled = true;
XmlDataProvider agriculture = new XmlDataProvider();
agriculture.Source = new Uri(@"Data\Lists\agriculture.xml", UriKind.Relative);
agriculture.XPath = "/AGRICULTURE";
System.Windows.Data.Binding binding = new Binding();
binding.Source = agriculture;
binding.XPath = "Category";
cboxSubcategory.SetBinding(ItemsControl.ItemsSourceProperty, binding);
cboxSubcategory.SelectedIndex = 0;
}
basically, I have two comboboxes and when an item from the first one is selected the second combobox is enabled, data from an XML file is loaded into it and the first item from the list should be selected... but it's not. The list is loaded correctly, but it remains on SelectedIndex -1.
Anybody knows what I'm doing wrong?
thank you.