我该如何处理witui 3

发布于 2025-01-20 08:49:08 字数 404 浏览 5 评论 0原文

这次,我必须将UWP应用程序迁移到Winui 3,到目前为止,除了一些小事情外,一切都很好,但是事件onsuspending根本没有触发。在命名空间Windows.ui.xaml中,您可以轻松地

this.Suspending += OnSuspending 

在app.xaml.cs中使用,这不是问题,在microsoft.ui.xaml中,我不能这样做。现在,我已经在app.xaml.cs中声明了desedeventHandler

public event SuspendingEventHandler Suspending; 

但这是行不通的。我该如何解决这个问题?

This time I must migrate an UWP App to WinUI 3, so far everything has worked well except for a few small things but the event OnSuspending is simply not triggered. In the namespace Windows.UI.Xaml you could easily use

this.Suspending += OnSuspending 

in app.xaml.cs and it wasn't a problem, in Microsoft.UI.Xaml I can't do this. I have now declared a SuspendingEventhandler in app.xaml.cs

public event SuspendingEventHandler Suspending; 

but this just doesn't work. How can I solve this problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谁把谁当真 2025-01-27 08:49:08

WinUI 3 可用于构建桌面/WIn32 Windows 应用程序(请参阅docs)并且此类应用程序是不暂停 因此不会引发任何 Suspending 事件。

WinUI 3 can be used to build desktop/WIn32 Windows apps (see the docs) and this kind of apps are not suspended so there is no Suspending event ever being raised.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文