[Enchantment] font icons theming theme aware bug fix#352
[Enchantment] font icons theming theme aware bug fix#352GID0317 wants to merge 3 commits intoiNKORE-NET:mainfrom
Conversation
Refactor foreground inheritance logic in IconElement.
Updated foreground handling in FontIcon to use data binding instead of manual property assignments. Removed legacy foreground inheritance logic.
NotYoojun
left a comment
There was a problem hiding this comment.
Thanks for working on this fix! I noticed that the original implementation had a specific Foreground inheritance mechanism (ShouldInheritForegroundFromVisualParent + manual propagation). With the new binding-based approach, it looks like that inheritance logic might no longer behave the same way—for example, when the control’s own Foreground is explicitly set vs. when it should inherit from its visual parent.
My concern is that this change could break scenarios where the icon was expected to follow its parent’s Foreground automatically. Could you clarify whether this new binding approach still preserves the original inheritance behavior, or if there are cases where it now diverges?
|
Thanks for the review. Yes, inheritance is preserved. If FontIcon.Foreground is unset, the glyph inherits/updates from its visual parent. if set, it uses that value. The only change is we no longer forcibly copy VisualParentForeground in rare edge cases where the control itself wouldn’t inherit. |
The stricter condition caused scenarios (like in the #343 (comment)) where an icon visually sat beside text that updated its brush, but the icon didn’t because the Parent/VisualParent relationship didn’t meet the extra inequality test. Removing Parent != VisualParent lets normal visual-parent brush changes flow more consistently.
After this change the Icons more reliably pick up ancestor Foreground (especially dynamic theme resources) when their own Foreground wasn’t explicitly set. Explicit Foreground still opt‑out automatically. No public API change.
The impact of change so far was very low. But it can be investigated more if it breaks something