I want to change the orientation property like the following below:
<Style x:Key="FlipViewStyleV" TargetType="FlipView">
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<VirtualizingStackPanel AreScrollSnapPointsRegular="True" Orientation="Vertical" />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
</Style>
And I want to let it worked when the device orientation changed, the orientation property should also follow the change. But it does not worked when I add a button in the code-behind to change the orientation from vertical to horizontal, does some one know?
Looks like changing the
Orientation
property of aFlipView
'sItemsPanel
doesn't work for some reason. So here's an alternative.You will need to duplicate your
FlipView
. One would implement aVertical
VirtualizingStackPanel
and the other aHorizontal
VirtualizingStackPanel
.Define them in your page's
Resources
.Then, you will want to use
SimpleOrientationSensor
to monitor the phone's orientation changes.After you have subscribed to its
OrientationChanged
event,in its callback, simply hide and show the
FlipView
s accordingly.