How to use CoreApplicationView with Prism in Windows Store App. RRS feed

  • Question

  • Hi 

    Is it possible to Create View using CoreApplicationView in Prism Based Windows Store app?

    I am using following code to create a new view but unfortunately was not been able to integrated it with prism. 

    Whenever i tried to create page having prism:ViewModelLocator.AutoWireViewModel="True" , I am getting exception i.e. Thread is marashalled for some other thread.

    Please help how to achieve it.

                    ApplicationView currentAppView = ApplicationView.GetForCurrentView();
                    CoreApplicationView appView = CoreApplication.CreateNewView();
                    var viewId = 0;
                    appView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
                        viewId = ApplicationView.GetForCurrentView().Id;

                        Window w = Window.Current;
                        Frame f = new Frame();
                        w.Content = f;
                        f.Navigate(typeof(TestPage), null);  
                        await ApplicationViewSwitcher.TryShowAsStandaloneAsync(
                catch(Exception ex)


    Friday, August 8, 2014 9:03 AM


  • For help with Prism please see the Prism discussion page at http://prismwindowsruntime.codeplex.com/discussions .

    I suspect that Prism isn't designed for this scenario and won't work. It probably assumes a single Dispatcher thread and has global state which cannot be used with two different Dispatchers (one for each ApplicationView). You may have more success with completely separate models rather than sharing, but I'm not familiar enough with Prism to know.


    Friday, August 8, 2014 6:59 PM