Silverlight 4.0 如果在资源字典中合并,您是否无法在App.xaml中拥有资源?
我们在应用程序xaml中附加了4个全局资源,这些资源是我们在应用程序中用来维护各种项目状态的类 下面是我们在app.xaml中使用它们的方式Silverlight 4.0 如果在资源字典中合并,您是否无法在App.xaml中拥有资源?,silverlight-4.0,resources,resourcedictionary,Silverlight 4.0,Resources,Resourcedictionary,我们在应用程序xaml中附加了4个全局资源,这些资源是我们在应用程序中用来维护各种项目状态的类 下面是我们在app.xaml中使用它们的方式 <Application.Resources> <AMSI:Global x:Key="AMSI.Global"/> <eFin:Global x:Key="eFinancials.Global" /> <eService:Global x:Key="eService.Global" /&g
<Application.Resources>
<AMSI:Global x:Key="AMSI.Global"/>
<eFin:Global x:Key="eFinancials.Global" />
<eService:Global x:Key="eService.Global" />
<eSite:Global x:Key="eSite.Global" />
... a bunch of styles and control templates here...
</Application.Resources>
它不再获得对AMSI.Global对象的引用。。。但在搬家之前,它一直运转良好
我做错了什么。如果我将这些全局对象移到外部或资源字典中,代码将再次运行,但blend告诉我xaml中有错误,那么当我尝试创建新控件模板时,它也找不到字典。此外,如果我创建控件模板,它们似乎找不到,即使它们与引用它的控件位于同一页上。因此,我假设在运行时会有一个问题需要解决
你知道这是怎么回事吗?我是否只需要将我所有的样式和模板移回app.xaml?我在silverlight有点新,但是,您尝试过添加吗
<AMSI:Global x:Key="AMSI.Global"/>
<eFin:Global x:Key="eFinancials.Global" />
<eService:Global x:Key="eService.Global" />
<eSite:Global x:Key="eSite.Global" />
到合并的词典?
它看起来像这样
<Application.Resources>
我通常只是在合并的词汇中添加我的资源,从来没有遇到过问题
问候
<AMSI:Global x:Key="AMSI.Global"/>
<eFin:Global x:Key="eFinancials.Global" />
<eService:Global x:Key="eService.Global" />
<eSite:Global x:Key="eSite.Global" />
<Application.Resources>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<AMSI:Global x:Key="AMSI.Global"/>
<eFin:Global x:Key="eFinancials.Global" />
<eService:Global x:Key="eService.Global" />
<eSite:Global x:Key="eSite.Global" />
</ResourceDictionary>
<ResourceDictionary Source="Resources/ControlStyles.xaml"/>
<ResourceDictionary Source="Resources/DefaultColors.xaml"/>
</ResourceDictionary.MergedDictionaries>