Windows Phone 8(Silverlight)プロジェクトを新しく作成しました。 追加テーマフォルダは、このフォルダにsolidcolorburshと色を含むものを含むものを2つのリソースの辞書を追加しました。Windows Phone 8プロジェクトの名前/キーでリソースを見つけることができません
私は、グリッドの背景に1 solidcolorburshを使用MainPage.xamlをでApp.xaml
におけるこれら2つのリソース辞書をマージ。
コードスニペット:
App.xaml:
<Application.Resources>
<ResourceDictionary x:Key="mainStyle">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/resTest;component/Themes/MyColors.xaml"></ResourceDictionary>
<ResourceDictionary Source="/resTest;component/Themes/MyStyles.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
<local:LocalizedStrings xmlns:local="clr-namespace:resTest" x:Key="LocalizedStrings"/>
</ResourceDictionary>
</Application.Resources>
MainPage.xamlを:
<Grid x:Name="LayoutRoot" Background="{StaticResource RedSolidColorBrush}">
</Grid>
MyColors.xaml:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Color x:Key="RedColor">#FFFF0000</Color>
</ResourceDictionary>
MyStyles.xaml:スロー
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<SolidColorBrush x:Key="RedSolidColorBrush" Color="{StaticResource RedColor}"></SolidColorBrush>
</ResourceDictionary>
が例外:私は間違っ
Blockquote
'System.Windows.Markup.XamlParseException' in System.Windows.ni.dll Its showing runtime error:
Exception thrown: 'System.Windows.Markup.XamlParseException' in System.Windows.ni.dll
Additional information: Cannot find a Resource with the Name/Key RedColor [Line: 14 Position: 44]
?
参考: https://msdn.microsoft.com/en-us/library/cc903952(VS.95).aspx
Referencing a merged resource dictionary in windows phone seven failing