I need to implement some functionality in a second Window
in UWP.
So I want to do following
- Start new
Window
in a Modal state so parentWindow
cannot be acceced.- On closed event return value to the parent
Window
.
I use following code to create a new Window please help me to archive these points
private async void Button_Click(object sender, RoutedEventArgs e)
{
var switchToView = true;
var newView = CoreApplication.CreateNewView();
int newViewId = 0;
await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
var frame = new Frame();
frame.Navigate(typeof(MyCam), null);
Window.Current.Content = frame;
newViewId = ApplicationView.GetForCurrentView().Id;
});
var viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId);
if (switchToView && viewShown)
{
// Switch to new view
await ApplicationViewSwitcher.SwitchAsync(newViewId);
}
}
I found nice solution here https://github.com/bkaankose/UWPModalDialogHelper
It is about to use Prism.Core
Nuget package to simulate fullscreen popup with custom UserControl.