【发布时间】:2015-07-07 17:10:22
【问题描述】:
我正在创建一个 Windows 通用应用程序,现在正在开发 Windows Phone 部分。我在 Storyboards.xaml 文件中放置了一个用于简单按钮动画的 Storyboard,并且我已将此文件与我的 App.xaml 资源合并。
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///Dictionaries/Templates.xaml"/>
<ResourceDictionary Source="ms-appx:///Dictionaries/Storyboards.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
我使用此代码定位情节提要
Storyboard sb = App.Current.Resources["StoryboardButton"] as Storyboard;
动画在主页上运行良好。但是一旦我转到其他页面并返回主页并重新启动动画,我就会收到此错误
WinRT information: Cannot find a resource with the given key.
我错过了什么?
【问题讨论】:
标签: xaml windows-runtime win-universal-app resourcedictionary