相关问题
插件创建的自定义窗口(Window、Dialog 等)无法自动跟随 STranslate 主程序的主题切换。 无论主程序设置为暗色还是亮色模式,插件窗口始终显示为亮色(或固定主题),导致视觉风格严重不一致。
描述你希望的解决方案
插件应能通过 IPluginContext 直接获取或应用主程序的当前主题,使自定义窗口与主程序保持实时一致的视觉风格。
描述你所考虑的替代方案
方案1:添加 CurrentTheme 属性
public interface IPluginContext
{
// … 现有成员
ElementTheme CurrentTheme { get; } // 获取当前主题(Dark/Light/Default)
}
插件使用:ThemeManager.SetRequestedTheme(myWindow, context.CurrentTheme);
方案2:添加 ApplyTheme 便捷方法
public interface IPluginContext
{
// … 现有成员
void ApplyTheme(Window window); // 直接将当前主题应用到指定窗口
}
方案3:提供通用的窗口创建工厂
public interface IPluginContext
{
// … 现有成员
T CreateWindow<T>() where T : Window, new(); // 创建已应用主题和 Owner 的窗口
}
我确认已查询历史issues
相关问题
插件创建的自定义窗口(Window、Dialog 等)无法自动跟随 STranslate 主程序的主题切换。 无论主程序设置为暗色还是亮色模式,插件窗口始终显示为亮色(或固定主题),导致视觉风格严重不一致。
描述你希望的解决方案
插件应能通过 IPluginContext 直接获取或应用主程序的当前主题,使自定义窗口与主程序保持实时一致的视觉风格。
描述你所考虑的替代方案
方案1:添加
CurrentTheme属性插件使用:
ThemeManager.SetRequestedTheme(myWindow, context.CurrentTheme);方案2:添加
ApplyTheme便捷方法方案3:提供通用的窗口创建工厂
我确认已查询历史issues