我有一台带有ItemsStackPanel的GridView,我想在设备旋转时更改它的方向。例如,如果ItemsPanelTemplate是这样定义的:
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsStackPanel GroupPadding="0,0,70,0" Orientation="Horizontal"/>
</ItemsPanelTemplate>
</GridView.ItemsPanel>我想以编程的方式将其转换为:
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsStackPanel GroupPadding="0,0,70,0" Orientation="Vertical"/>
</ItemsPanelTemplate>
</GridView.ItemsPanel>我不知道如何直接访问这个对象。
发布于 2014-02-21 06:35:09
最好的方法是创建两个您想要使用的视图。看看Visual Studio 2012提供的"Grid App“模板。它有一个GridView和一个ListView。对设备进行快照时,会隐藏GridView并通过VisualState显示ListView
https://stackoverflow.com/questions/21917011
复制相似问题