locked
How to reference a core set of XAML resources? (Becky Yates) - 2/19/2008 8:14 AM PST RRS feed

  • Question

  • By: Becky Yates


    I'm looking for a way to reference a core set of XAML resources (controls, 
    colours etc) from different solutions. I have tried the following:
    
    * creating a DLL containing a ResourceDictionary with links to the controls 
    and colours XAML, and then referencing the DLL using a pack URI: 
        <ResourceDictionary>
          <ResourceDictionary.MergedDictionaries>
             <ResourceDictionary 
    Source="pack://application:,,,/CoreControls;component/CoreDictionary.xaml"/>
          </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    
    This does not build cleanly; the error is that the resource cannot be found, 
    but the application will still run. In design view there are warnings that 
    the referenced colour resources cannot be found. These are DynamicResources, 
    if I change them to StaticResources the warning becomes an error.
    
    * as above but without using MergedDictionaries, i.e. just
        <ResourceDictionary 
    Source="pack://application:,,,/CoreControls;component/CoreDictionary.xaml"/>
        
    This builds cleanly but I assume that I would not be able to add any more 
    resources in app.xaml. The warnings/errors about colours are still present, 
    so the design view is not working.
    
    * trying the above in Blend 2; the design view of the referencing form 
    crashed.
    
    * trying the above in Blend 2, with the core colours project in the same 
    solution and with a project reference instead of a DLL reference. This 
    worked, but this is not a practical solution because I am trying to avoid 
    duplicating the core XAML across different solutions.
    
    Can anyone suggest a way forward?
    
    Thanks,
    Becky
    Friday, February 22, 2008 7:01 PM

All replies