Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Please answer few things for me...</p> <ol> <li>Is "WPF Custom Control Library" assembly same as "WpfTestControls" assembly?</li> <li>If not, then does "WPF Custom Control Library" have a reference to the "WpfTestControls" assembly?</li> <li>Does your <code>WpfTestApp</code> have a reference to both "WPF Custom Control Library" and "WpfTestControls" assemblies?</li> </ol> <p>If you add that reference(s), the resources should load correctly.</p> <p><strong>My Steps...</strong></p> <ol> <li>Add a "WPF Custom Control Library" say "ThemesLibray"</li> <li>In this add two resource dictionaries under "Themes" folder</li> </ol> <p><strong>TextBoxStyle.xaml</strong></p> <pre><code> &lt;ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; &lt;Style x:Key="GreenTextBoxStyle" TargetType="{x:Type TextBox}"&gt; &lt;Setter Property="Background" Value="Green"/&gt; &lt;/Style&gt; &lt;/ResourceDictionary&gt; </code></pre> <p><strong>Generic.xaml</strong></p> <pre><code> &lt;ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; &lt;ResourceDictionary.MergedDictionaries&gt; &lt;ResourceDictionary Source="TextBoxStyle.xaml"/&gt; &lt;/ResourceDictionary.MergedDictionaries&gt; &lt;/ResourceDictionary&gt; </code></pre> <ol start="3"> <li><p>I have main starup project "MyWPFTestApp" that has assembly reference to <code>ThemesLibray</code>. In that the window has <code>ThemesLibrary</code> resources merged this way....</p> <pre><code>&lt;Window x:Class="MyWPFTestApp.Window7" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window7" Height="300" Width="300"&gt; &lt;Window.Resources&gt; &lt;ResourceDictionary&gt; &lt;ResourceDictionary.MergedDictionaries&gt; &lt;ResourceDictionary Source="/ThemseLibrary;component/Themes/Generic.xaml"/&gt; &lt;/ResourceDictionary.MergedDictionaries&gt; &lt;/ResourceDictionary&gt; &lt;/Window.Resources&gt; &lt;Grid&gt; &lt;TextBox Style="{StaticResource GreenTextBoxStyle}"/&gt; &lt;/Grid&gt; &lt;/Window&gt; </code></pre></li> </ol> <p>When I launch MyWPFTestApp, I see the Window with green TextBox.</p>
    singulars
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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