I have an ObservableCollection<SchedulesInMonth>
object, the class is something like this:
public class SchedulesInMonth : INotifyPropertyChanged
{
private Dictionary<int, Dictionary<int, Schedule>> _schedules;
public Dictionary<int, Dictionary<int, Schedule>> Schedules
{
get => _schedules; set
{
_schedules = value;
OnPropertyChanged("Schedules");
}
}
// other property and method not related to this problem
// skipped for simplicity
}
the Schedules contain Dictionary of 28-31 schedules each day with a day in month as key, each schedules of a day is composed with 0-3 schedule(s), because the work shift is 3 each day.
If I do this:
ScheduleInMonths[row].Schedules[row].Clear();
The datagrid is not updated, even though the ObservableCollection is changed.
EDIT:
upon my discovery, if I do this:
var temp = ScheduleInMonths[row].Schedules;
temp[col].Clear();
ScheduleInMonths[row].Schedules = temp;
The datagrid that bounded to ObservableCollection is updated.