How to update parent screens in lightwitch mode?

I want to update the search screens after adding new data from other screens. I tried to do

foreach (var parentScreen in this.Application.ActiveScreens.OfType<ScreenType>()) { //Invoke the refresh parentScreen.Details.Dispatcher.BeginInvoke(() => parentScreen.Details.Commands.Refresh.Execute()); } 

but it does not work in beta 2

+4
source share
1 answer

found this at http://social.msdn.microsoft.com/Forums/en-US/lightswitchgeneral/thread/cf86ad21-48fb-48f2-87d4-e5b15f8f361c#e6879629-145a-4b18-834c-ebee0cfe1473

Unfortunately, the ActiveScreens collection does not actually contain a set of Screen objects. It contains a proxy class that can be used to access the actual display object (this is due to the fact that different threads work in different threads). Here is a sample code that provides what you need.

  Microsoft.LightSwitch.Client.IActiveScreen searchScreen = Application.ActiveScreens.Where(a => a.Screen is SearchCustomers).FirstOrDefault(); searchScreen.Screen.Details.Dispatcher.BeginInvoke(() => { ((SearchCustomers)searchScreen.Screen).Customers.Refresh(); }); 
+10
source

All Articles