我想使用VisualStateManager將屬性值設置爲屬性。問題是我需要在嵌套元素(稱爲variableSizedWrapGrid)上設置此值,但它不響應相應的狀態。這個想法是當用戶改變平板電腦的方向(橫向到縱向)並且應該改變這個元素的方向。如何設置嵌套元素的可視化狀態?
<GroupStyle.Panel>
<ItemsPanelTemplate>
<VariableSizedWrapGrid x:Name="variableSizedWrapGrid" Orientation="Vertical" Background="Blue" Width="660" ItemHeight="120" ItemWidth="220" Margin="0,0,80,0">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState x:Name="FullScreenPortrait">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Orientation)">
<DiscreteObjectKeyFrame KeyTime="0" Value="Horizontal" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</VariableSizedWrapGrid>
</ItemsPanelTemplate>
</GroupStyle.Panel>
我正在開發一個Windows Metro應用的Windows 8