[英]MahApps.Metro cannot find resources
我正在嘗試使用MahApps.Metro創建新的WPF應用程序。 我完全按照快速入門指南( http://mahapps.com/MahApps.Metro/guides/quick-start.html )中的描述進行操作:
此時我可以運行應用程序,但窗口是透明的。 標題欄文本和按鈕是可見的(按鈕未設置樣式),但背景是透明的。
之后我在啟動時收到一個例外:
System.IOException
{"Cannot locate resource 'styles/colours.xaml'."}
似乎由於某種原因它無法在程序集中找到資源。 但我不明白為什么。
來自維基
'顏色' - >'顏色'
是的,我們將所有
Colours
改為Colors
! 顏色的命名不一致,所以我們決定更改命名。 資源字典也從Colours.xaml
到Colors.xaml
。
發行說明為0.11.0
<Application x:Class="WpfApplication.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<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" />
<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>
</Application.Resources>
</Application>
<controls:MetroWindow x:Class="WpfApplication.MainWindow"
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"
Title="MainWindow"
Height="600"
Width="800">
<Grid>
<!-- now your content -->
</Grid>
</controls:MetroWindow>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.