I have a really weird situation with dependent comboboxes and I am about to pull my hair out!!
I have 3 Comboboxes that display data from the selected item in a listview for editing. The DataContext for the UserControl is the Same as the Listbox.
When I go select different items on the listbox the data in the 2nd and 3rd combo gets removed, and therefore setting the data in the initial row to disappear. Other Comboboxes work correctly.
I have tried also to make these comboboxes independent woth code on Dropdown Close to lose the child data, however this does not work because binding to the 3rd (nullable)
<!-- User Control Resources -->
<CollectionViewSource x:Key="cvsNatureCategoryGroup"/>
<CollectionViewSource x:Key="cvsNatureCategory" Source="{Binding Path=NatureCategories, Source={StaticResource cvsNatureCategoryGroup}}" />
<CollectionViewSource x:Key="cvsNatureCategorySub" Source="{Binding Path=NatureCategorySubs, Source={StaticResource cvsNatureCategory}}" />
<!-- Combo Boxes -->
<ComboBox Grid.Column="1" Grid.Row="1"
SelectedValue="{Binding Path=NatureCategoryGroupId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}"
IsSynchronizedWithCurrentItem="True"
SelectedValuePath="NatureCategoryGroupId"
ItemsSource="{Binding Source={StaticResource cvsNatureCategoryGroup}}"
Name="cboNatureCategoryGroupId"
DisplayMemberPath="NatureCategoryGroupName"
/>
<ComboBox Grid.Column="1" Grid.Row="2"
SelectedValuePath="NatureCategoryId"
SelectedValue="{Binding Path=NatureCategoryId,
Mode=TwoWay, UpdateSourceTrigger=PropertyChanged,
NotifyOnValidationError=True, ValidatesOnDataErrors=True,
ValidatesOnExceptions=True}"
IsSynchronizedWithCurrentItem="True"
ItemsSource="{Binding Source={StaticResource cvsNatureCategory}}"
DisplayMemberPath="NatureCategoryName"
Name="cboNatureCategory" />
<ComboBox y:ComboUtil.AllowNull="True"
Grid.Column="1" Grid.Row="4"
SelectedValue="{Binding Path=NatureCategorySubId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}"
IsSynchronizedWithCurrentItem="True"
SelectedValuePath="NatureCategorySubId"
ItemsSource="{Binding Source={StaticResource cvsNatureCategorySub}}"
Name="cboNatureSubCategory" />
As I scroll up and down the listboxes the 2nd and 3rd combobox go blank and remove value of data in them that is without changing any data below.
HELP