✅ Invalidating inherited Properties Tree in WPF
I'm trying to implement an inherited list property (called
InheritedCustomContextList
) which merged all of the values for my property called CustomContext
in the visual tree (e.g. if window has ObjA, Grid has ObjB, then the value of InheritedCustomContextList
for a child inside of the grid will contain ObjA and ObjB).
I managed to get it to work by setting the value for InheritedCustomContextList
to the parent's value + the CustomContext
value (if available), and I do basically the same the Coerce callback for InheritedCustomContextList
My problem though is that, If I change CustomContext
for the window, then that child inside the grid will still reference ObjA, because WPF's tree walker thing that updates inherited values does not continue walking once it sees a DP has a local value set (in this case, it reaches the Grid, sees that it has a local value for InheritedCustomContextList
and stops).
I'm not sure how to fix this, maybe if there was a way to regenerate all inherited values for the entire visual tree (starting at the window's content element). Any help would be great 😄0 Replies