
I have an object that has a Category and SubCategory property. I want the SubCategory options change depending on what is set for the main category. I also want to display the options to the user in combobox form.
Example Data:
Category UPPERCASE:
SubCategory: VALUE1
SubCategory: VALUE2
Category lowercase:
SubCategory: value1
SubCategory: value2
I have each of the properties displaying to the user via combo boxes (I create DataTemplates for the properties and assign the "[Editor(...)]" attribute to the property.
What I want is to be able to change the ItemsSource of the "SubCategory" combo box based on the value in the "Category" combo box. In the example data, when they select "lowercase", "value1" and "value2" will show up while "VALUE1" and "VALUE2" will not.
How do I correctly do this?
---
Here is the code that I am using for the DataTemplate:
Example Data:
Category UPPERCASE:
SubCategory: VALUE1
SubCategory: VALUE2
Category lowercase:
SubCategory: value1
SubCategory: value2
I have each of the properties displaying to the user via combo boxes (I create DataTemplates for the properties and assign the "[Editor(...)]" attribute to the property.
What I want is to be able to change the ItemsSource of the "SubCategory" combo box based on the value in the "Category" combo box. In the example data, when they select "lowercase", "value1" and "value2" will show up while "VALUE1" and "VALUE2" will not.
How do I correctly do this?
---
Here is the code that I am using for the DataTemplate:
<DataTemplate x:Key="MyTemplate">
<Grid>
<ComboBox
SelectedValue=
"{Binding Value,
RelativeSource={RelativeSource AncestorType={x:Type Primitives:IPropertyDataAccessor}},
Mode=TwoWay,
ValidatesOnExceptions=True,
NotifyOnValidationError=True}"
ItemsSource=???
/>
</Grid>
</DataTemplate>