WP7 Mango の ResourceDictionary に問題があります。
インターネットで見つけたもののほとんどは、次のように簡単です。
1) 本文を含む Xaml ファイル:
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="TextBlockStyle1" TargetType="TextBlock">
<Setter Property="Foreground" Value="Orange"/>
<Setter Property="FontSize" Value="24"/>
<Setter Property="VerticalAlignment" Value="Bottom"/>
</Style>
</ResourceDictionary>
2) App.xaml に以下を追加します。
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="MyResources.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
なぜ機能しないのかわかりません。このようにすると、例外が発生します。
タイプ 'ResourceDictionary' は ResourceDictionary 内にあり、キーを持っていません。
ステップ 2 で xaml の 2 行目に ked を追加すると実行されますが、不明なエラーでクラッシュします。MyResources.xaml ファイルからリソースを追加していないようです。
誰かがここで解決策を指摘できますか?