Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Accessing resources in referenced assemby
Message
De
22/10/2009 06:45:51
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Windows Presentation Foundation (WPF)
Titre:
Accessing resources in referenced assemby
Versions des environnements
Environment:
C# 3.0
Divers
Thread ID:
01430576
Message ID:
01430576
Vues:
68
Hi,
Here's my resource dictionary for the main application:
ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <ResourceDictionary.MergedDictionaries>
        <!--<ResourceDictionary Source="TreeView Resources/StdDataTemplates.xaml"/>
        <ResourceDictionary Source="TreeView Resources/StdTreeViewItemStyle.xaml"/>-->
        <ResourceDictionary Source="pack://application:,,,/GlobalResources;component/Themes/generic.xaml" />
    </ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
This is in the constructor of a class in an assembly referenced by the main assembly:
Style style = (Style)Application.Current.FindResource("StdTreeViewItemStyle");
This works fine at runtime. At design time it doesn't find the resource when using the GlobalResources assemblies resources (but does work if I use the commented version - i.e. additional dictionaries in the main app).
Is there a syntax for the FindResource() that *will* work?
TIA,
Viv
Répondre
Fil
Voir

Click here to load this message in the networking platform