private static void ContextChanged(object sender, DependencyPropertyChangedEventArgs e) { DependencyObject Element = (DependencyObject)sender; // Clear local path, so that parent value is inherited for this element UiFeatureManagement.ReEvaluateContextPath(Element); }
private static void NotifyChildrenThatContextPathChanged(DependencyObject element) { if (element is Visual || element is Visual3D) { for (int Index = 0; Index < VisualTreeHelper.GetChildrenCount(element); Index++) { DependencyObject Child = VisualTreeHelper.GetChild(element, Index); if (Child.ReadLocalValue(UiFeatureManagement.ContextPathProperty) != DependencyProperty.UnsetValue) //if ( UIFeatureManagement.GetContext(Child) != null) { //there is a Context registered. this means, the context path must be re-evaluated. //re-evaluation of children will be done in the called method UiFeatureManagement.ReEvaluateContextPath(Child); } else { //no context is specified here, so check the children UiFeatureManagement.NotifyChildrenThatContextPathChanged(Child); } } } }