0

我想在ZoomOutView活动时停用某些按钮。根据MSDN,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-elements 放入让我们说“Snapped”VisualState(和适当的 VisualStateGroup)时,它可以工作,所以按钮名称应该没有问题。

4

1 回答 1

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>
于 2013-04-16T12:26:39.927 回答