Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to define resources AND a MergeDictionary with a key in a SL4 page
    primarykey
    data
    text
    <p>This is probably a really stupid question but I can't figure this out.</p> <p>I have a page with a MergeDictionary defined: </p> <pre><code> &lt;navigation:Page.Resources&gt; &lt;ResourceDictionary&gt; &lt;ResourceDictionary.MergedDictionaries&gt; &lt;ResourceDictionary Source="../Assets/TourneySetupStyles.xaml"/&gt; &lt;/ResourceDictionary.MergedDictionaries&gt; &lt;/ResourceDictionary&gt; &lt;/navigation:Page.Resources&gt; </code></pre> <p>and I reference the styles in TourneySetupStyles.xaml in my XAML like this with no problem:</p> <pre><code>&lt;TextBlock Text="Tourney Name:" Style="{StaticResource TourneySetupTextStyle}" /&gt; </code></pre> <p>However, now I need to add another page resource like this:</p> <p> </p> <p>But the designer now throws a warning: "The designer does not support loading dictionaries that mix 'ResourceDictionary' items without a key and other items in the same collection. Please ensure that the 'Resources' property does not contain 'ResourceDictionary' items without a key, or that the 'ResourceDictionary' item is the only element in the collection."</p> <p>So I add a key to my ResourceDictionary like this: </p> <pre><code> &lt;navigation:Page.Resources&gt; &lt;local:Tournament x:Key="tournament" /&gt; &lt;ResourceDictionary x:Key="whatever"&gt; &lt;ResourceDictionary.MergedDictionaries&gt; &lt;ResourceDictionary Source="../Assets/TourneySetupStyles.xaml"/&gt; &lt;/ResourceDictionary.MergedDictionaries&gt; &lt;/ResourceDictionary&gt; &lt;/navigation:Page.Resources&gt; </code></pre> <p>and the warning goes away. BUT now my reference to the style in TourneySetupStyles no longer works:</p> <p>"Cannot find a Resource with the Name/Key TourneySetupTextStyle"</p> <p>So I guess the question is: How do I access the style now that the ResourceDictionary is keyed?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload