如何在 lightswitch 中刷新父屏幕?
我想在从其他屏幕添加新数据后刷新搜索屏幕。我试过了
foreach (var parentScreen in this.Application.ActiveScreens.OfType<ScreenType>())
{
//Invoke the refresh
parentScreen.Details.Dispatcher.BeginInvoke(() => parentScreen.Details.Commands.Refresh.Execute());
}
,但在 Beta 2 中似乎不起作用
I want to refresh the search screens after adding new data from other screens. I've tried doing
foreach (var parentScreen in this.Application.ActiveScreens.OfType<ScreenType>())
{
//Invoke the refresh
parentScreen.Details.Dispatcher.BeginInvoke(() => parentScreen.Details.Commands.Refresh.Execute());
}
but it doesn't seem to work in Beta 2
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
发现它在
<一href="http://social.msdn.microsoft.com/Forums/en-US/lightswitchgeneral/thread/cf86ad21-48fb-48f2-87d4-e5b15f8f361c#e6879629-145a-4b18-834c-ebee0cfe1473 ">http://social.msdn.microsoft.com/Forums/en-US/lightswitchgeneral/thread/cf86ad21-48fb-48f2-87d4-e5b15f8f361c#e6879629-145a-4b18-834c-ebee0cfe1473
不幸的是,ActiveScreens 集合实际上并不包含一组 Screen 对象。它包含一个代理类,您可以使用该代理类来访问实际的屏幕对象(这是由于不同的线程在不同的线程中运行)。这是一些实现您需要的示例代码。
found it on
http://social.msdn.microsoft.com/Forums/en-US/lightswitchgeneral/thread/cf86ad21-48fb-48f2-87d4-e5b15f8f361c#e6879629-145a-4b18-834c-ebee0cfe1473
Unfortunately the collection of ActiveScreens does not actually contain a set of Screen objects. It contains a proxy class that you can use to access the actual screen object (this is due to different threads running in different threads). Here is some sample code that achieves what you need.