我有一个UWP应用,并且在右下角有一个按钮(聊天按钮),当我单击该按钮时,从我的XAML主页的右下角打开一个新的XAML页面(用于聊天窗口)。我有以下代码:
CoreApplicationView newView = CoreApplication.CreateNewView();
int newViewId = 0;
await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
Frame frame = new Frame();
frame.Navigate(typeof(About), null);
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);
我想为第二个XAML(关于)页面设置一个固定的大小,并且我正在使用以下代码:
ApplicationView.PreferredLaunchViewSize = new Size(480, 800);
ApplicationView.PreferredLaunchWindowingMode =
ApplicationViewWindowingMode.PreferredLaunchViewSize