Window height and width fixed based on initial orientation
- Dominant language
- C#
- Stars
- 23.3k
- Forks
- 2k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 290
Description
### Description
when getting the current height and width of a window, these do not adjust if the orientation changes.
For example, if you start your app in portrait, and get the height and width, you might get (say) 1000 for the height and 600 for the width. If you change to landscape, this should be reversed - height would be 600 and width would be 800.
However, these do not change, they are always fixed to whatever they were set as based on the starting orientation.
**Note:** I don't know if this is a bug, or if this expected. If expected, should be noted in the docs.
### Steps to Reproduce
1. Get the height and width of `Application.Current.MainPage` and `Application.Current.Windows[0]` and compare them
2. Rotate the device
3. Get the height and width of `Application.Current.MainPage` and `Application.Current.Windows[0]` again and compare them
4. Observe that they don't match
### Link to public reproduction project repository
https://github.com/matt-goldman/WindowDimensionsBug
### Version with bug
9.0.60 SR6
### Is this a regression from previous behavior?
No, this is something new, Not sure, did not test other versions
### Last version that worked well
Unknown/Other
### Affected platforms
iOS, Android, Windows, macOS
### Affected platform versions
All
### Did you find any workaround?
Getting the width and height of `Application.Current.MainPage` works as expected; however this is makred as obsolete.
Getting the width and height of `Application.Current.Windows[0].Page` works as expected. As mentioned above this may be the correct usage here, but if that's the case it's not clear from the docs.
### Relevant log output
```shell
```
Contributor guide
Research direction
Start with the linked WindowDimensionsBug reproduction and compare Application.Current.MainPage with Application.Current.Windows[0] before and after rotating the device on the affected platforms. Trace the window dimension entry points to determine the intended behavior, then make the API behavior consistent or clarify the correct usage in the documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, csharp, ios
- Domain
- desktop-dev, frontend, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100