使内容对话框像Groove应用中的对话框一样可移动 [英] make a content Dialog movable like the one in the Groove app

查看:64
本文介绍了使内容对话框像Groove应用中的对话框一样可移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个ContentDialog来应用样式(我不能在消息对话框和弹出窗口中应用),但是我遇到了问题,它无法移动或无法像框架那样关闭它当我在Groove应用程序中单击"Connexion"按钮时出现

I have created a ContentDialog to apply a Style (that I can't apply with a Message Dialog and a PopUp),but I am having problem with it,it's not movable or I can't close it like the Frame that appears when I click on the button "Connexion"in the Groove App

请问您有什么想法,我可以在 ContentDialog样式,使该ContentDialog可移动并像顶部的图像一样将其关闭

have you please any idea,which part I can modify in the ContentDialog style to get this ContentDialog movable and close it like the image on top

我正在开发通用应用

推荐答案

您有任何想法吗,我可以按照ContentDialog样式修改哪一部分,以使此ContentDialog可移动并像上图一样将其关闭.

have you please any idea,which part I can modify in the ContentDialog style to get this ContentDialog movable and close it like the image on top.

恐怕 ContentDialog 不可移动,并且您在Groove应用程序或系统邮件应用程序中显示的图像不是 ContentDialog ,实际上,此对话框"由 UserDataAccountManager.ShowAddAccountAsync .如果使用ProcessMonitor跟踪此UI,我们将发现这是一个系统应用程序C:\ Windows \ SystemApps \ Microsoft.AccountsControl_cw5n1h2txyewy.您可能会在类似的问题上看到这样的图片和信息: UWP模态窗口.

I'm afraid ContentDialog is not movable, and the image you showed in the Groove App or in the System's mail app is not a ContentDialog, actually, this "Dialog" is called by UserDataAccountManager.ShowAddAccountAsync. If we used the ProcessMonitor to track this UI, we will find that this is a system app C:\Windows\SystemApps\Microsoft.AccountsControl_cw5n1h2txyewy. You may see the pictures and information in the similar question on SO: UWP Modal Window.

对于您的问题,我们无法启动Microsoft.AccountsControl之类的系统应用来获取结果,我们只能使用API​​ UserDataAccountManager.ShowAddAccountAsync 对其进行调用.但是您可以创建一个UWP应用程序,然后从另一个应用程序中启动该应用程序以获取结果,为此,请参考启动应用程序以获取结果.

For you problem, we can’t launch the system app like Microsoft.AccountsControl for result, we can only call it using API UserDataAccountManager.ShowAddAccountAsync. But you can create a UWP app, and launch this app for result from another app, to do this, please refer to Launch an app for results.

或者,如果您只是想要一个可移动的UI,则可以在应用中创建一个新窗口,并更改此新窗口的大小,使其弹出行为类似于 ContentDialog ,但是此新窗口将显示您的应用标题,该标题无法删除.

Or if you just want a movable UI, you can create a new window in your app, and change the size of this new window, make it popping behavior like a ContentDialog, but this new window will show your app's title which can't be removed.

如何创建新窗口?例如:

How to create a new window? For example:

    private async void OnClick(object sender, RoutedEventArgs e)
    {
        var newCoreAppView = CoreApplication.CreateNewView();
        var appView = ApplicationView.GetForCurrentView();
        await newCoreAppView.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Low, async () =>
        {
            var window = Window.Current;
            var newAppView = ApplicationView.GetForCurrentView();

            var frame = new Frame();
            window.Content = frame;

            frame.Navigate(typeof(BlankPage));            
            window.Activate();
            await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newAppView.Id, ViewSizePreference.Default, appView.Id, ViewSizePreference.Default);

        });
    }

以及如何更改新窗口的大小?例如,在新窗口中显示的页面的CS文件中:

And how to change the size of the new Window? For example in the cs file of the page showed in the new window:

public BlankPage()
        {
            this.InitializeComponent();
            this.Loaded += Page_Loaded;
        }

        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            var s = ApplicationView.GetForCurrentView();
            s.TryResizeView(new Size { Width = 600, Height = 320 });
        }

这将创建一个600宽度和320高度的窗口.

This will make a 600 width and 320 height window.

这篇关于使内容对话框像Groove应用中的对话框一样可移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆