gpt4 book ai didi

mahapps.metro - Mahapps metro 主题不可用,因为没有 app.xaml

转载 作者:行者123 更新时间:2023-12-02 17:03:12 26 4
gpt4 key购买 nike

我正在开发一个 Office 加载项,并想添加一个 WPF Mahapps Windows

一切顺利,但我无法应用 Mahapps Windows 样式。
看教程here我看到我更新了 App.xaml 以添加各种主题。因为它不是 WPF 项目,所以我没有 App.xaml

应用样式最有效的方法是什么?
我可以直接在 Windows 级别执行吗?
还是我需要手动创建一个 App.xaml

最佳答案

您也可以将所有 MahApps.Metro 资源放在 Window 资源标签中,例如

<Controls:MetroWindow x:Class="StyledWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls="http://metro.mahapps.com/winfx/xaml/controls">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!-- MahApps.Metro resource dictionaries. Make sure that all file names are Case Sensitive! -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml"/>
<!-- Accent and AppTheme setting -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>

<Grid>
</Grid>
</Controls:MetroWindow>

希望对您有所帮助!

关于mahapps.metro - Mahapps metro 主题不可用,因为没有 app.xaml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53040545/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com