Issue
I’m using the following code to launch a secondary window.
static async Task OpenSecondaryWindow(ContentPage contentPage) {
var coreApplicationView CoreApplication.CreateNewView();
int viewId 0;
await coreApplicationView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () > {
var frame new Windows.UI.Xaml.Controls.Frame();
frame.Navigate(contentPage);
Window.Current.Content frame;
Window.Current.Activate();
viewId ApplicationView.GetForCurrentView().Id;
App.StyleViews();
});
bool viewShown await ApplicationViewSwitcher.TryShowAsStandaloneAsync(viewId);
}
ContentPage is of the same class that’s instantiated and set to MainPage in my Xamarin.Forms.Application.
The problem I’m having is that when sizing the secondary window, the frame sizes, but not the content. What do I need to do to get the content to size as well?
Solution
This does the trick.
frame.SizeChanged + delegate (object sender, SizeChangedEventArgs e) {
contentPage.Layout(new Rectangle(0, 0, e.NewSize.Width, e.NewSize.Height));
};
Answered By – Tim