I have a maui app with blazor and I'm creating a custom titlebar.
I about to close the maui app, using on blazor Application.Current.Quit();
Now how can i minimize and move maui app
My code blazor
private void MoveWindow()
{
}
private void MinimizeWindow()
{
}
private void CloseWindow() {
Application.Current.Quit();
}
Maui already has a function to minimize the application.
Use the following in your blazor:
private void MinimizeWindow()
{
#if WINDOWS
var Window = App.Current.Windows.First();
var nativeWindow = Window.Handler.PlatformView;
IntPtr windowHandle = WinRT.Interop.WindowNative.GetWindowHandle(nativeWindow);
WindowId WindowId = Win32Interop.GetWindowIdFromWindow(windowHandle);
AppWindow appWindow = AppWindow.GetFromWindowId(WindowId);
var p = appWindow.Presenter as OverlappedPresenter;
p.Minimize();
#endif
}