Silverlight Cascading Combobox
- by lidermin
Hi, I have an issue trying to implement cascading comboboxes on Silverlight 3. I have two comboboxes:
Product Type
Sub Cathegory
The user need to select the Product type, and based on his selection, the second combobox must load the sub cathegories.
Binding the first combobox is a piece of cake:
<ComboBox x:Name="cmbProductType" Margin="11,2,8,5" MaxDropDownHeight="100" Grid.Column="1 />
cmbProductType.ItemsSource = objFactory.ProductTypes;
objFactory.Load(objFactory.GetProductTypesQuery());
My issue is trying to load the second combobox based on the first seleccion. I tryied to implement the SelectionChanged event on the first combobox, but it didn't worked for me:
private void cmbProductType_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
FactoryDS objFactory = new FactoryDS();
cmbSubCat.ItemsSource = objFactMetas.Campos;
objFactory.Load(objFactory.GetSubCathegoryQuery(((SybCathegroy)cmbProductType.SelectedItem).Id));
}
How should I do this? (I'm new on Silverlight). thanks in advance.