1

Closed我的VisualState有问题ComboBox。状态动画Closed仅第一次播放。

  • 第一次打开ComboBox 【所有动画OK】
  • ComboBox第二次打开【无Closed动画】

这是我正在使用的 XAML:

<VisualStateGroup x:Name="DropDownStates">
    <VisualState x:Name="Opened">
        <Storyboard>
            <SplitOpenThemeAnimation ClosedTargetName="ContentPresenter"
         OpenedTargetName="PopupBorder"
         ClosedLength="0"
         OpenedLength="{Binding TemplateSettings.DropDownOpenedHeight, RelativeSource={RelativeSource Mode=TemplatedParent}}" />             
            <ColorAnimation To="Transparent"
                            Duration="0:0:0.1"
                            Storyboard.TargetProperty="(UIElement.BorderBrush).(SolidColorBrush.Color)"
                            Storyboard.TargetName="Background"/>
                <DoubleAnimation Storyboard.TargetName="DropDownGlyph"
                             Storyboard.TargetProperty="Opacity"
                             To="0"
                             Duration="0:0:0.2">
                <DoubleAnimation.EasingFunction>
                    <PowerEase EasingMode="EaseIn" />
                </DoubleAnimation.EasingFunction>
            </DoubleAnimation>
        </Storyboard>
    </VisualState>
    <VisualState x:Name="Closed">
        <Storyboard>
            <SplitCloseThemeAnimation ClosedTargetName="ContentPresenter"
          OpenedTargetName="PopupBorder"
          ClosedLength="0"
          OpenedLength="{Binding TemplateSettings.DropDownOpenedHeight, RelativeSource={RelativeSource Mode=TemplatedParent}}" />
            <ColorAnimation To="#66D3D3D3"
                            Duration="0:0:0.1"
                            Storyboard.TargetProperty="(UIElement.BorderBrush).(SolidColorBrush.Color)"
                            Storyboard.TargetName="Background" />
            <DoubleAnimation Storyboard.TargetName="DropDownGlyph"
                             Storyboard.TargetProperty="Opacity"
                             To="1"
                             Duration="0:0:0.2">
                <DoubleAnimation.EasingFunction>
                    <PowerEase EasingMode="EaseIn" />
                </DoubleAnimation.EasingFunction>
            </DoubleAnimation>
        </Storyboard>
    </VisualState>
</VisualStateGroup>  

你能给我一些建议吗,我做错了什么?谢谢!

4

1 回答 1

0

我为此使用的解决方法是VisualState从我的样式中删除“已关闭”。一旦我这样做了,ComboBox就会按预期工作。

于 2016-05-12T16:24:50.763 回答