// Returns true when the coerce callback should return the current system metric private static bool ShouldUseSystemFont(FrameworkElement fe, DependencyProperty dp) { bool hasModifiers; // Return the current system font when (changing the system theme OR creating an element and the default is outdated) // AND the element is a root AND the element has not had a value set on it by the user return (SystemResources.SystemResourcesAreChanging || (fe.ReadInternalFlag(InternalFlags.CreatingRoot) && SystemResources.SystemResourcesHaveChanged)) && fe._parent == null && VisualTreeHelper.GetParent(fe) == null && fe.GetValueSource(dp, null, out hasModifiers) == BaseValueSourceInternal.Default; }
private static bool ShouldUseSystemFont(FrameworkElement fe, DependencyProperty dp) { if ((SystemResources.SystemResourcesAreChanging || fe.ReadInternalFlag(InternalFlags.CreatingRoot) && SystemResources.SystemResourcesHaveChanged) && (fe._parent == null && VisualTreeHelper.GetParent((DependencyObject) fe) == null)) { bool hasModifiers; return fe.GetValueSource(dp, (PropertyMetadata) null, out hasModifiers) == BaseValueSourceInternal.Default; } else return false; }