[HELP] How to specify a fixed size for the application window? (.NET MAUI Blazor WinUI) #2370
-
Hi, I'm working on an application using the .NET MAUI Blazor template. This application is mainly targeting Windows and I'd like to be able to specify a fixed application window size. Is this currently possible? I'm able to set the size of the BlazorWebView within MainPage.xaml using the WidthRequest and HeightRequest properties but this does not affect the overall window size. |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 36 replies
-
For anyone else having this issue, here's what ended up working for me:
|
Beta Was this translation helpful? Give feedback.
-
I have another option that doesn't rely on PInvoke directly and works >preview12. To work with The
|
Beta Was this translation helpful? Give feedback.
-
There is a library here... with enums. css styling in c# and some cal(). |
Beta Was this translation helpful? Give feedback.
-
Updated for Maui GA:
OR if want to base it on requested dimensions of MainPage, before appending handler could do:
then use those dimensions (probably add some padding to get whole window size, because MainPage is client area). |
Beta Was this translation helpful? Give feedback.
-
It would be nice if someone publishes and make available the best practices for Desktop and Tablet Idioms. |
Beta Was this translation helpful? Give feedback.
-
FWIW, with latest MAUI (& WinAppSDK/WinUI3), it's much simpler, here is a full
It uses the |
Beta Was this translation helpful? Give feedback.
-
I have a similar problem, but in my case my app window shrinks when running the app inside a remote session via a macBook Pro with retina display. How can I achieve that my app window appears in same size in relation to screen width/height? |
Beta Was this translation helpful? Give feedback.
For anyone else having this issue, here's what ended up working for me: