Silverlight 从另一个类访问故事板
我面临着一个我自己可能无法解决的问题,我现在正在研究解决方案 2 天,并在其他论坛等中浏览了很多 - 但似乎我就是不明白。
我的问题
我的用户控件“MainPage”中有一个名为“getVisible”的 Storyboard,我想在另一个名为“test.cs”的类中访问它
,但是,由于 Storyboard 是在 MainPage.xaml 中定义的,并且只有应用程序资源可以访问,我是否面临无法从另一个类加载故事板的问题。
有什么想法如何解决这个问题吗?
〜问候马特
I'm facing a problem that I probably can't solve on my own, I'm working on a solution now for 2 days and browsed a lot in other Forums etc. - but it seems like that I just don't get it.
My problem
I have a Storyboard called "getVisible" in my UserControl "MainPage" that I want to access in another class called "test.cs"
However, as the Storyboard is defined in the MainPage.xaml and only the App Resources are accessible, do I face the problem that I can't load Storyboards from another class.
Any ideas how to solve that?
~regards Matt
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从 test.cs 获取情节提要的一种选择是创建 MainPage 的实例。
或者,您可能希望考虑在单独的资源字典中创建资源,然后从两个位置引用该共享资源字典。
One option to get the storyboard from test.cs is to create an instance of MainPage.
Alternatively though, you may wish to consider creating the resources in a separate resource dictionary and then referencing that shared resource dictionary from both loactions.