In this post, we will see how to resolve How to prevent the main form closed by the user in .NET MAUI?
Question:
In windows form native application we can prevent a user to close the application when they press “X” button in the top right. the below code is an example code when the user tries to close the application, instead of closing the application will be minimized mode:I tried an ovveride method like OnDisappearing but no luck
Best Answer:
You can using the following code in the OnHandlerChanged method of the MainPage.cs.If you have better answer, please add a comment about this, thank you!
Source: Stackoverflow.com