当语义缩放变化时停用按钮



我想在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 -元素放入,让我们说"snaps"的VisualState(和适当的VisualStateGroup),它的工作,所以不应该有一个问题与按钮名称

试试这个,我已经把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>

最新更新