I use the following dictionary:
private Dictionary<string, string> _myDic;
public Dictionary<string, string> MyDic
{
get
{
return _myDic;
}
set
{
if (_myDic!= value)
{
_myDic= value;
NotifyPropertyChanged("MyDic");
}
}
}
Is bind to a combobox in my view.
Everything works.
The problem is that when I add item is not updated if already opened the combobox.
Only if it remains closed from the beginning then the change appears on the screen.
I have a single place where I add item to dictionary and immediately I used the event propertychanged
hoping it will affect the UI:
MyDic.Add(strK, strV);
NotifyPropertyChanged("MyDic");
But it did not help (although the event did not coming null).
I understand that it is because it is a change in the collection, not the object itself. My problem is that I can not change the type of this variable to cutsom ObservableDictionary for various reasons.
My question is why the NotifyPropertyChanged("MyDic");
is not affected. And is there any other way (except to change the type) to deal with this problem?