Hi guys, I have 2 comboboxes which we will call cbo1 and cbo2. Now, there is a relationship between cbo1 and cbo2. when i select an item at cbo1, the cbo2 ItemsSource is updated (since it is bound to the SelectedItem) anyway, below is the sample XAML code for it.
<ComboBox x:Name="cbo1" Grid.Row="0" Grid.Column="1" Margin="5" SelectedItem="{Binding Path=Brand}"></ComboBox>
<ComboBox x:Name="cbo2" Grid.Row="1" Grid.Column="1" Margin="5" SelectedItem="{Binding Path=Model}" ItemsSource="{Binding ElementName=cbo1, Path=SelectedItem.Models}" DisplayMemberPath="Name"></ComboBox>
the objects used are Brand and Model. Brand has a property named Models which contain a collection of Model objects ( typeof IList ). So basically, a one-many relationship between the 2 classes.
By the way, those 2 classes are used in NHibernate. Now, when I run the app, cbo1 which contains a collection of Brand objects is loaded with the items first. When I select a Brand item, the cbo2 with the Model collection is populated. As you have noticed, both Comboboxes have SelectedItem property bound to the current object properties Brand and Model specifically. When I select a Model on the cbo2, it does not reflect to the current object's Model property. Anything i missed?