gpt4 book ai didi

c# - 使内容对话框像 Groove 应用程序中的那样可移动

转载 作者:太空宇宙 更新时间:2023-11-03 18:25:14 24 4
gpt4 key购买 nike

我创建了一个 ContentDialog 来应用样式(我不能将其应用到消息对话框和弹出窗口),但我遇到了问题,它不可移动或者我无法像 Frame 那样关闭它当我点击 Groove App 中的“Connexion”按钮时出现 enter image description here

你有什么想法,我可以在the ContentDialog style中修改哪一部分吗?使这个 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 App 或系统的邮件应用程序中显示的图像不是 ContentDialog,实际上,这个“对话”由UserDataAccountManager.ShowAddAccountAsync调用.如果我们使用ProcessMonitor来跟踪这个UI,我们会发现这是一个系统应用C:\Windows\SystemApps\Microsoft.AccountsControl_cw5n1h2txyewy。您可能会在 SO 上的类似问题中看到图片和信息:UWP Modal Window .

对于您的问题,我们无法为结果启动像 Microsoft.AccountsControl 这样的系统应用程序,我们只能使用 API UserDataAccountManager.ShowAddAccountAsync 调用它。但是您可以创建一个 UWP 应用程序,并启动此应用程序以获取来自另一个应用程序的结果,为此,请参阅 Launch an app for results .

或者如果你只是想要一个可移动的用户界面,你可以在你的应用程序中创建一个新窗口,并改变这个新窗口的大小,让它像 ContentDialog 一样弹出行为,但是这个新窗口将显示您的应用程序的标题,该标题无法删除。

如何创建新窗口?例如:

    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文件中:

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 高的窗口。

关于c# - 使内容对话框像 Groove 应用程序中的那样可移动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35929032/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com