[♻️ Housekepping] Until .NET 9 we should avoid Application.MainPage
pictos opened this issue · comments
The .NET MAUI team is deprecating the usage of Application.MainPage
because it, normally, isn't what devs/we expect to be. In a MultiWindow scenario it can return the wrong Page.
One way to workaround this is to change Application.Current.MainPage
to Application.Current.Windows[0].Page
.
At least for me, isn't 100% clear what Windows[0]
means:
- it's the first window at collection
- it's the topmost window
- it's the focused window
For join the discussion at .NET MAUI repo, please go here.
Maybe, today we already have a bug for multi-window apps, but since no user has reported any issue we don't need to rush on this.