Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I handle OnSuspending with WinUI 3

Tags:

c#

winui-3

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?

like image 632
KarsaOrlong1981 Avatar asked Nov 28 '25 04:11

KarsaOrlong1981


1 Answers

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.

like image 122
mm8 Avatar answered Nov 29 '25 17:11

mm8



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!