InvalidateArrange method can only be used for updating the layout of the UIElement
which has their own orientation property, for example StackPanel.
How do I implement this in my code so that the page or frame does not change its orientation?
So, this method is not related to your problem, I think what you need is to forbidden your layout to update from landscape mode or portrait mode?
To do this, you can open up your manifest file and check the Supported rotations
for example just enable the Landscape layout
:

By default they are unchecked so can your page or frame update its layout to adjust to the window. Or you can refer to this thread: How to enable only landscape mode in a UWP app? The Api in the question can also be used.