Windows 8.1 RTM で開発しています。double 型のカスタム依存関係プロパティを持つカスタム コントロールがあります。このコントロールは、ユーザー コントロールに配置されています。ユーザー コントロールで VisualStateManager.GoToState(control, true) を呼び出しています。アニメーションは 2 秒間遷移します。ただし、0 から 1 および 1 から 0 に単純にスナップします。コールバック関数は、0 または 1 でのみ呼び出されます。依存関係プロパティを 0 から 1 の間の任意の値に直接設定すると、期待どおりに動作します。
次の XAML があります。
<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:controls="using:MyControls" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="TestStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0:0:2"/>
</VisualStateGroup.Transitions>
<VisualState x:Name="A">
<Storyboard>
<DoubleAnimation
EnableDependentAnimation="True"
Duration="0"
Storyboard.TargetName="MyControl1"
Storyboard.TargetProperty="MyDependencyProperty"
To="0"/>
</Storyboard>
</VisualState>
<VisualState x:Name="B">
<Storyboard>
<DoubleAnimation
EnableDependentAnimation="True"
Duration="0"
Storyboard.TargetName="MyControl1"
Storyboard.TargetProperty="MyDependencyProperty"
To="1"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<controls:MyControl x:Name="MyControl1" MyDependencyProperty="0">
</Grid>
</UserControl>
ターゲット プロパティを Opacity に設定すると、機能します。
以前の質問を見ると、EnableDependentAnimation がこの動作の一般的な原因のようですが、私は既に true に設定しています。
Timeline.AllowDependentAnimations は true です。
コントロールを削除して、コールバックにロジックを持たない 1 つの依存関係プロパティだけにしました。同じ問題。