Been round in circles with this issue.
I have 2 ComboBoxes. User makes a selection on the first ComboBox & the 2nd ComboBox displays options depending on the 1st selection.
I'm binding the 2nd ComboBox
to a static Dictionary<string,string>
exposed in my view model. I have another public property which raises INPC on the static Dictionary. In the UI, the changes are not displayed. I'm getting no errors in the Output window. Is there something I'm missing?
p.s. this functioned fine under .NET4.0. As soon as user machines installed .NET4.5, this behaviour started only with this 1 ComboBox bound to a Dictionary...
Properties:
private static Dictionary<string, string> _ModelArticleTypeCodeToChangeTitleMap;
public static Dictionary<string, string> ModelArticleTypeCodeToChangeTitleMap
{
get { return _ModelArticleTypeCodeToChangeTitleMap; }
set
{
_ModelArticleTypeCodeToChangeTitleMap = value;
}
}
//Default ArticleTypeCodeToTitleMapFilteredByCategory dictionary to the full list (as no Category will have been initially selected)
private Dictionary<string, string> _ModelArticleTypeCodeToTitleMapFilteredByCategory = ModelArticleTypeCodeToTitleMap;
public Dictionary<string, string> ModelArticleTypeCodeToTitleMapFilteredByCategory
{
get { return _ModelArticleTypeCodeToChangeTitleMap; }
set
{
_ModelArticleTypeCodeToChangeTitleMap = value;
OnPropertyChanged("ModelArticleTypeCodeToChangeTitleMap");
}
}
Xaml:
<ComboBox DisplayMemberPath="Value" HorizontalAlignment="Left", Converter={StaticResource invertBoolConverter}}" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding Path=ModelArticleCategoryToTitleMap, Mode=TwoWay}" SelectedValue="{Binding ModelSelectedArticleCategory}" SelectedValuePath="Key"/>
<ComboBox ItemsSource="{Binding Path=ModelArticleTypeCodeToChangeTitleMap, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding IsEditModeTitleReadOnly, Converter={StaticResource invertBoolConverter}}" IsSynchronizedWithCurrentItem="True" DisplayMemberPath="Value" SelectedValuePath="Key" SelectedValue="{Binding ModelSelectedArticleTypeCode}" Text="{Binding ModelEnteredTitle}" TabIndex="1" />