グローバルリソースディクショナリを使用しようとしていますが、それに含まれるスタイルを使用しようとするとエラーが発生します。私が持っている私app.xamlで:Windows Phone 7:グローバルリソースが見つかりません
<ListBox Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" x:Name="lstCategories" SelectionMode="Extended" Style="{StaticResource CategoryListTemplate}" ...
:私はスタイルを設定しようとしている
<Style x:Key="CategoryListTemplate" TargetType="ListBox">
<Setter Property="Background" Value="Transparent" />
<Setter Property="SelectionMode" Value="Extended" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style TargetType="ListBoxItem">
<Setter Property="Margin" Value="2" />
<Setter Property="Template">
....
:/Themes/ListBox.xamlで
<Application.Resources>
<ViewModel:ViewModelLocator x:Key="Locator"
d:IsDataSource="True" />
<ResourceDictionary x:Key="dict1">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Themes/ListBox.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
ザ・、私はこれを持っています
Viwの読み込み中に「XamlParseException - Name/Key CategoryListTemplate [Line:30 Position:42]」というリソースが見つからない場合は、エラーが発生します。 42行目はリストボックス定義を含む行で、Style="{StaticResource CategoryListTemplate}"
です。
LitBox.xamlのビルドアクションはResourceで設定されていますが、これは正しく動作するはずです。