I am trying Show multiple views for an app for Prism Library UWP.
I got System.NullReferenceException for frame.Navigate(typeof(ScreenCapture)); like below:
async void ExecuteNewWindow()
{
CoreApplicationView newView = CoreApplication.CreateNewView();
int newViewId = 0;
await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
Frame frame = new Frame();
frame.Navigate(typeof(ScreenCapture));
Window.Current.Content = frame;
// You have to activate the window in order to show it later.
Window.Current.Activate();
newViewId = ApplicationView.GetForCurrentView().Id;
});
bool viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId);
}
How to implement multiple view in Prism library for uwp.
Your project is Xamarin.Forms, but the parameter of
frame.Navigate(typeof(ScreenCapture));is uwp Page type. I checked your code,ScreenCaptureis FormsContentPage. For your requirement, you could use Dependency service to callExecuteNewWindowand placeExecuteNewWindowin UWP project.Interface
Implement
Usage
Please don't forget register it in uwp app.xaml.cs file.