Replies: 2 comments 2 replies
-
This might be too late to respond, but if anyone else is googling this as I was: The normal way to do this would be through |
Beta Was this translation helpful? Give feedback.
-
In Mac Catalyst (Desktop project, but the API should behave the same on IOS) I have had luck with The Windows UI looks to handle rendering and layout measurement events differently than Mac. That said here is the basics of layout phases. Key Phases in the XAML Layout Lifecycle:
There's several places to hook into during these phases which should be able to get you dimension values.
and protected override async void OnAppearing()
{
base.OnAppearing();
await Task.Delay(100); // Short delay to allow layout measurement to complete, THIS IS NOT IDEAL!
var width = this.Width;
var height = this.Height;
Console.WriteLine($"MainPage Width: {width}, Height: {height}");
} It should be noted that my app is a fully drawn SkiaSharp application so I'm accessing |
Beta Was this translation helpful? Give feedback.
-
I need layout according to window size, such as at ipad, app can multiple task, that mean window not full screen, i need detect window size and use different layout with full screen.
But i don't know when to get correct window size, when i try get MainPage size at constructor, the Width and Height are not correct. I found have SizeChang event, it will be loaded multiple when window show at Windows, so i need set layout at SizeChange event handler method?
I hope have a best practice for develop maui app🤔
Beta Was this translation helpful? Give feedback.
All reactions