コード例 #1
0
        private async Task CreateChildWindowAsync()
        {
            _newWindow = await AppWindow.TryCreateAsync();

            _newWindow.RequestSize(new Size(200, 200));
            _newWindow.RequestMoveAdjacentToCurrentView();
            _newWindow.Frame.SetFrameStyle(AppWindowFrameStyle.NoFrame);
            _newWindow.Presenter.RequestPresentation(AppWindowPresentationKind.CompactOverlay);
            await _newWindow.TryShowAsync();
        }
コード例 #2
0
        public async Task<bool> TryCreateNewWindowAsync(TabViewViewModel tabView, Size size)
        {
            AppWindow appWindow = await AppWindow.TryCreateAsync();

            Frame frame = new Frame();
            frame.Navigate(typeof(AppWindowPage), new TabViewNavigationParameters(tabView, appWindow));

            ElementCompositionPreview.SetAppWindowContent(appWindow, frame);

            WindowManagementPreview.SetPreferredMinSize(appWindow, new Size(MinWindowWidth, MinWindowHeight));
            appWindow.RequestSize(size);

            appWindow.TitleBar.ExtendsContentIntoTitleBar = true;
            appWindow.TitleBar.ButtonBackgroundColor = Colors.Transparent;
            appWindow.TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent;

            appWindow.RequestMoveAdjacentToCurrentView();

            bool success = await appWindow.TryShowAsync();

            return success;
        }