使用 InvalidateArrange UWP 的方向

Orientation using InvalidateArrange UWP

在 Microsoft 文档中我发现了以下内容:

Controls that maintain their own orientation property might call InvalidateArrange

如何在我的代码中实现这一点以使页面或框架不改变其方向?

已经感谢您的帮助!

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?

所以,这个方法与你的问题无关,我想你需要的是禁止你的布局从横向模式或纵向模式更新?

为此,您可以打开清单文件并检查 Supported rotations 例如只需启用 Landscape layout:

默认情况下它们是未选中的,因此您的页面或框架可以更新其布局以适应 window。或者你可以参考这个帖子: 问题中的Api也可以用