【发布时间】:2022-12-05 08:21:16
【问题描述】:
我是第一次构建 Maui 应用程序,并希望采用 Material Design。我通常根据项目使用 MahApps 或 Material Design。但是,添加资源字典时出现 Uri 错误
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Presentation"
x:Class="Presentation.App">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/Styles/Colors.xaml" />
<ResourceDictionary Source="Resources/Styles/Styles.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignExtensions;component/Themes/Generic.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignExtensions;component/Themes/MaterialDesignLightTheme.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
代码每次都会崩溃,但如果我错过了最后 3 个资源字典(那些指的是 Material Design),我就不会遇到任何问题。我已经将 Material Design 添加为 NuGet 包以及扩展。谁能看到我所做的任何愚蠢的事情???
谢谢
【问题讨论】:
-
您是否尝试过在 MAUI 中为 WPF 使用 MaterialDesign?我认为这暂时不可能。
标签: c# wpf xaml material-design maui