Simplify style copying by setting BasedOn directly

Refactored ThemeHelper.CopyStyle to assign the target style's BasedOn property directly from the original style, instead of recursively copying base style properties. This reduces complexity and ensures correct style inheritance.
This commit is contained in:
Jack251970 2026-03-09 18:17:50 +08:00
parent ac404666bb
commit 2bf6e2634c

View file

@ -8,10 +8,10 @@ public static class ThemeHelper
{
public static void CopyStyle(Style originalStyle, Style targetStyle)
{
// If the style is based on another style, copy the base style first
// If the style is based on another style, use the same base style for the target style
if (originalStyle.BasedOn != null)
{
CopyStyle(originalStyle.BasedOn, targetStyle);
targetStyle.BasedOn = originalStyle.BasedOn;
}
// Copy the setters from the original style