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
Button
that opens a new window - Implemented
IWindow
for 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.Width
andWindow.Height
after the window is created. Also, addDispatcherQueue.TryEnqueue
around the sizing code.Thanks, Mike! That solved it. I also had to enable
UseMauiWinUI
in the csproj.