I'm having Xamarin.Forms application with GTK platform implementation. What I'm trying to do is to show confirmation alert once user closes main window. The alert should ask user if he wants to proceed and exit application. That was pretty easy on WPF platform, but there were difficulty with GTK platform.
Subscribing to DeleteEvent
didn't help.
My code is something like this:
[STAThread]
public static void Main(string[] args)
{
Gtk.Application.Init();
Forms.Init();
var app = new App();
var window = new FormsWindow();
window.LoadApplication(app);
window.SetApplicationTitle("Nts");
window.Show();
window.DeleteEvent += Window_DeleteEvent; //this is not fired
Gtk.Application.Run();
}
private static void Window_DeleteEvent(object o, Gtk.DeleteEventArgs args)
{
//show alert
}
Expected that on clicking "Close" button or Alt + F4 of application window will fire the DeleteEvent
and call Window_DeleteEvent
logic but event is not fired and application closes.
Updated
Shared project: Net Standard 2.0 Xamarin.Forms version 4.1.0.618606
GTK project: Net Framework 4.8 Xamarin.Forms version 4.1.0.618606 Xamarin.Forms.Platform.GTK version 3.6.0.344457