Xaml 如何使用VisualStateManager更改控制方向?
当我在Windows 8.1应用程序中使用VisualStateManager更改HubControl的方向属性时,该应用程序会因未处理的Win32异常而崩溃Xaml 如何使用VisualStateManager更改控制方向?,xaml,windows-8.1,visualstatemanager,Xaml,Windows 8.1,Visualstatemanager,当我在Windows 8.1应用程序中使用VisualStateManager更改HubControl的方向属性时,该应用程序会因未处理的Win32异常而崩溃 <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="ApplicationViewStates"> <VisualState x:Name="Landscape"> <Storyboard>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="ApplicationViewStates">
<VisualState x:Name="Landscape">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Hub" Storyboard.TargetProperty="Orientation">
<DiscreteObjectKeyFrame KeyTime="0" Value="Horizontal"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Portrait">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Hub" Storyboard.TargetProperty="Orientation">
<DiscreteObjectKeyFrame KeyTime="0" Value="Vertical"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
当我更改HubControl的其他属性(例如其可见性)时,它的工作方式与我预期的一样。我是否做错了什么,或者定向属性不能这样设置有什么原因?我也有同样的问题。你能查到这件事的真相吗?没有。我最终放弃了,并在代码背后解决了它。