I've tried for some time to figure out how to synchronize one combobox with another. I am wanting to sync comboboxes at runtime. When the user selects a category in the combobox, depending on their choice, the combobox subcategory will display the subcategories of the selected category.
I'm using WPF and C # with EntityFramework 6.
In my application, I can read in my ViewModel what was selected in the comboBox in View. I would like to know how do I dynamically update a combobox by ordering from what was selected in another combobox using the MVVM standard. Here are excerpts from the code:
<ComboBox Name="cbCategoria"
ItemsSource="{Binding NomeCategorias}"
SelectedItem="{Binding NomeCategoria}"
Width="175" />
<ComboBox Name="cbSubCtg"
ItemsSource="{Binding NomeSubCategorias}"
SelectedItem="{Binding NomeSubCategoria}"
Width="175" />
As you can see, there in my ViewModel I save what I read in ComoboBox cbCategoria
in variable NomeCategoria
.
Thanks in advance for any help.