Silverlight 3合并资源问题

时间:2009-08-04 21:36:56

标签: c# .net silverlight

我已定义了一个自定义resourceDictionary,我已将其添加到app.xaml资源中         

我在Theme.xaml中有一个带有“MyStyle”键的样式。 如何从MainPage.xaml访问MyStyle样式?

1 个答案:

答案 0 :(得分:0)

您是否在App.xaml中试过这个: -

 <Application.Resources>
   <ResourceDictionary>
     <!-- You other resources here -->
     <ResourceDictionary.MergedDictionaries>
       <ResourceDictionary Source="Theme.xaml" />
     </ResourceDictionary.MergedDictionaries>
   </ResourceDictionary>
 </Application.Resources>
 ...

现在,您应该能够从MainPage.xaml中{StaticResource MyStyle}