MEF解决方案中资源字典的可用性

时间:2011-01-25 00:26:00

标签: silverlight-4.0

我正在创建一个使用MVVM和MEF的Silverlight应用程序。在主项目的app.xml文件中,我指定了资源字典:

    <Application   
  x:Class="RAP.App"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:app="clr-namespace:RAP"
  xmlns:telerikControls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" 
  xmlns:Resources="clr-namespace:RAP.Assets.Resources" 
  Startup="Application_Startup"
  UnhandledException="Application_UnhandledException">

    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Assets/StylesX.xaml"/>
                <ResourceDictionary Source="Assets/Styles.xaml"/>
                <ResourceDictionary>
                    <app:ApplicationResources x:Key="ApplicationResources" />
                    <app:NotOperatorValueConverter x:Key="NotOperatorValueConverter" />
                                        <app:IsNullConverter x:Key="IsNullConverter" />
                    <Resources:ResourceWrapper x:Key="ResourceWrapper" />
                                        <telerikControls:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
                                        <telerikControls:InvertedBooleanToVisibilityConverter x:Key="InvertedBooleanToVisibilityConverter"/>
                </ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>

</Application>

在主项目中,StaticResource引用资源字典中的项目正确解析,但在后续项目中,xap是动态加载的,在设计时,StaticResource引用未解析并导致xaml设计器加载问题。我认为通过在主项目的app.xml中指定资源字典,资源字典可用于解决方案中的所有项目。我还需要做些什么才能将资源字典暴露给解决方案的其他项目吗?

0 个答案:

没有答案