语义缩放更改时取消激活按钮

时间:2013-04-16 11:46:32

标签: windows-store-apps winrt-xaml

我想在ZoomOutView处于活动状态时停用某些按钮。根据{{​​3}},VisualStateGroup的名称是“SemanticZoomStates”,VisualState的名称是“ZoomOutView”。所以我尝试了以下内容:

<VisualStateManager.VisualStateGroups>
    <VisualStateGroup x:Name="SemanticZoomStates">
        <VisualState x:Name="ZoomInView" />

        <VisualState x:Name="ZoomOutView">
            <Storyboard>
                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="editDocButton" Storyboard.TargetProperty="IsEnabled">
                    <DiscreteObjectKeyFrame KeyTime="0" Value="False"/>
                </ObjectAnimationUsingKeyFrames>
                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="deleteDocButton" Storyboard.TargetProperty="IsEnabled">
                    <DiscreteObjectKeyFrame KeyTime="0" Value="False"/>
                </ObjectAnimationUsingKeyFrames>
            </Storyboard>
        </VisualState>
    </VisualStateGroup>
</VisualStateManager.VisualStateGroups>

当我将ObjectAnimationUsingKeyFrames - 元素放入让我们说“Snapped”VisualState(以及相应的VisualStateGroup)时,它可以工作,所以按钮名称应该没有问题。

1 个答案:

答案 0 :(得分:0)

试试这个,我已将IsEnabled更改为(UIElement.IsEnabled)

<VisualStateManager.VisualStateGroups>
    <VisualStateGroup x:Name="SemanticZoomStates">
        <VisualState x:Name="ZoomInView" />
        <VisualState x:Name="ZoomOutView">
            <Storyboard>
                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="editDocButton" Storyboard.TargetProperty="(UIElement.IsEnabled)">
                    <DiscreteObjectKeyFrame KeyTime="0" Value="False"/>
                </ObjectAnimationUsingKeyFrames>
                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="deleteDocButton" Storyboard.TargetProperty="(UIElement.IsEnabled)">
                    <DiscreteObjectKeyFrame KeyTime="0" Value="False"/>
                </ObjectAnimationUsingKeyFrames>
            </Storyboard>
        </VisualState>
    </VisualStateGroup>
</VisualStateManager.VisualStateGroups>