We have a datasource that has a multiple nested classes. In general, there's a datastore which represetns a calendar year. It contains a collection of months, and each month contains a collection of days. Now, the problem is that we have a dozen or so properties that calculate total horus and what not for a month, half a year, and the entire year. Each of those properties are databound. in one particular case we added MultiBinding to bind the Text proeprty of a TextBlock to the datastore:
<MultiBinding...>
<Binding Source={StaticResource datastore} />
<Binding Source={StaticResource datastore} Path="Months/ProjectId" />
</MultiBinding>
One TexBlock for the current month (we are keeping track of that in the datastore) and one TextBlock for the entire year. Each one displays the total project hours for the respective period:
<MultiBinding...>
<Binding Source={StaticResource datastore} Path="Months/" />
<Binding Source={StaticResource datastore} Path="Months/ProjectId" />
</MultiBinding>
Notice that the first MultiBinding is to the year, and the second to the current month in the collection of months.
Why MultiBinding? Because we need the ProjectId as an input parameter to an indexer which returns the total hours for the respective period:
public TimeSpan this [projectId] {...} would give us the total hours for the entire year. We have the same indexer for the month class.
The problem we have is that the INPC notification never gets fired. To circumvent this, we added a property that looks like this:
public DataStore Store
{
get { return this; }
}
and say
FirePropertyChangedEvent("Store");
where appropriate.
First I thought we can use
FirePropertyChangedEvent("Item[]");
but that doesn't work.
My question is this: Why is it neccessary to expose the root class as a property to make sure WPF gets notified of a change in that class? What am I missing here?