我想让我的控件在延迟一段时间后启动视觉状态转换动画。 我尝试在可视状态故事板上设置BeginTime。但它什么都没有:( 有没有办法做到这一点?
<i:Interaction.Triggers>
<i:EventTrigger EventName="Loaded" SourceObject="{Binding ElementName=controlRoot}">
<ei:GoToStateAction StateName="MouseOverData"/>
</i:EventTrigger>
<i:EventTrigger EventName="MouseEnter" SourceObject="{Binding ElementName=textBlockChart}">
<ei:GoToStateAction StateName="MouseOverCharts"/>
</i:EventTrigger>
<i:EventTrigger EventName="MouseLeave" SourceObject="{Binding ElementName=textBlockChart}">
<ei:GoToStateAction StateName="Normal"/>
</i:EventTrigger>
<i:EventTrigger EventName="MouseEnter" SourceObject="{Binding ElementName=grid}">
<ei:GoToStateAction StateName="MouseOverCharts"/>
</i:EventTrigger>
<i:EventTrigger EventName="MouseLeave" SourceObject="{Binding ElementName=grid}">
<ei:GoToStateAction StateName="Normal"/>
</i:EventTrigger>
<i:EventTrigger EventName="MouseEnter" SourceObject="{Binding ElementName=textBlockData}">
<ei:GoToStateAction StateName="MouseOverData"/>
</i:EventTrigger>
<i:EventTrigger EventName="MouseLeave" SourceObject="{Binding ElementName=textBlockData}">
<ei:GoToStateAction StateName="Normal"/>
</i:EventTrigger>
<i:EventTrigger EventName="MouseEnter" SourceObject="{Binding ElementName=grid1}">
<ei:GoToStateAction StateName="MouseOverData"/>
</i:EventTrigger>
<i:EventTrigger EventName="MouseLeave" SourceObject="{Binding ElementName=grid1}">
<ei:GoToStateAction StateName="Normal"/>
</i:EventTrigger>
</i:Interaction.Triggers>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0:0:0.2" />
<VisualTransition From="MouseOverCharts" GeneratedDuration="0:0:0.2" To="Normal">
<VisualTransition.GeneratedEasingFunction>
<CircleEase EasingMode="EaseIn"/>
</VisualTransition.GeneratedEasingFunction>
</VisualTransition>
</VisualStateGroup.Transitions>
<VisualState x:Name="MouseOverCharts">
<Storyboard>
<ColorAnimation Duration="0" To="#FFEFE78A" Storyboard.TargetProperty="(UIElement.Effect).(DropShadowEffect.Color)" Storyboard.TargetName="textBlockChart" d:IsOptimized="True"/>
<DoubleAnimation Duration="0" To="10" Storyboard.TargetProperty="(UIElement.Effect).(DropShadowEffect.BlurRadius)" Storyboard.TargetName="textBlockChart" d:IsOptimized="True"/>
<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Effect).(DropShadowEffect.ShadowDepth)" Storyboard.TargetName="textBlockChart" d:IsOptimized="True"/>
<ColorAnimation Duration="0" To="#FFEFE78A" Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="textBlockChartContent" d:IsOptimized="True"/>
<DoubleAnimation Duration="0" To="220" Storyboard.TargetProperty="(FrameworkElement.Width)" Storyboard.TargetName="grid" d:IsOptimized="True"/>
</Storyboard>
</VisualState>
<VisualState x:Name="MouseOverData">
<Storyboard BeginTime="0:0:10">
<ColorAnimation BeginTime="0:0:5" Duration="0" To="#FFEFE78A" Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="textBlockDataContent" d:IsOptimized="True"/>
<ColorAnimation BeginTime="0:0:5" Duration="0" To="#FFEFE78A" Storyboard.TargetProperty="(UIElement.Effect).(DropShadowEffect.Color)" Storyboard.TargetName="textBlockData" d:IsOptimized="True"/>
<DoubleAnimation BeginTime="0:0:5" Duration="0" To="10" Storyboard.TargetProperty="(UIElement.Effect).(DropShadowEffect.BlurRadius)" Storyboard.TargetName="textBlockData" d:IsOptimized="True"/>
<DoubleAnimation BeginTime="0:0:5" Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Effect).(DropShadowEffect.ShadowDepth)" Storyboard.TargetName="textBlockData" d:IsOptimized="True"/>
<DoubleAnimation BeginTime="0:0:5" Duration="0" To="220" Storyboard.TargetProperty="(FrameworkElement.Width)" Storyboard.TargetName="grid1" d:IsOptimized="True"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Normal"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
感谢。
答案 0 :(得分:1)
答案 1 :(得分:0)
尝试删除GeneratedDuration="0:0:0.2"
<VisualTransition GeneratedDuration="0:0:0.2" />