Microsoft Emulator: What triggers the SizeChanged event?

Nathan Sokalski 4,121 Reputation points
2020-06-11T01:38:59.567+00:00

When using the Microsoft Emulator for a UWP app, I have noticed that the SizeChanged event is not always triggered if the device is rotated. For example, if the device has the 2 screens above/below each other and my app is single screen on the top, rotated 90 counterclockwise, when I click the Rotate Right button, the device screens become side by side with my app on the right, unrotated. This does not trigger the SizeChanged event. My basic goal is to have my app be ALWAYS right side up (which means it would never have been rotated 90 to begin with), and be able to span 1 or 2 screens. But if SizeChanged (or any other event I could find) is not always triggered for scenarios like this, how can I determine when to rearrange my layout? Will the actual device always trigger events the same way as the Microsoft Emulator? With previous devices I have developed for, the device would always (unless the code explicitly stated otherwise) display the app right side up. Can anybody help me? Thanks.

Universal Windows Platform (UWP)
{count} votes

Accepted answer
  1. Nathan Sokalski 4,121 Reputation points
    2020-06-12T17:43:50.223+00:00

    Thank you so much! I think by using the combination of SizeChanged & OrientationChanged (since it seems some of the properties such as ActualWidth & ActualHeight have not yet been updated when OrientationChanged is triggered) I can accomplish everything I need. Thank you again for all your help!

    0 comments No comments

0 additional answers

Sort by: Most helpful