我已定义了一个自定义resourceDictionary,我已将其添加到app.xaml资源中
我在Theme.xaml中有一个带有“MyStyle”键的样式。 如何从MainPage.xaml访问MyStyle样式?
答案 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}
。