Getting Started with .NET MAUI for Desktop Applications
Hi everyone, I'm new to .NET MAUI and I'm trying to build a cross‑platform desktop app using C#. I've followed the official docs, but I'm hitting a snag with window handling on Windows. Any tips?
What I've tried:
- Created a new MAUI project with
dotnet new maui - Added a simple
Buttonthat opens a new window - Implemented
IWindowfor custom sizing
When I run the app, the new window appears but it's invisible on Windows 10. It works fine on macOS.
Any ideas on what I'm missing?
Comments
Make sure you set
Window.WidthandWindow.Heightafter the window is created. Also, addDispatcherQueue.TryEnqueuearound the sizing code.Thanks, Mike! That solved it. I also had to enable
UseMauiWinUIin the csproj.