0

Blend を one my two UserControls、deleted<UserControl.Resources>で使用して不透明アニメーションを作成し<UserControl.Triggers>Storyboard.TargetNameそこから配置するApp.xamlと、次のようになります。

<Storyboard x:Key="Loaded">
    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" >
        <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
        <EasingDoubleKeyFrame KeyTime="0:0:3" Value="1"/>
    </DoubleAnimationUsingKeyFrames>
</Storyboard>

Contentmy の を設定する前に、次のようなコードで呼び出すとContentControl:

Storyboard sb = FindResource("Loaded") as Storyboard;
sb.begin(uc1);
content.Content = uc1;

//and

Storyboard sb = FindResource("Loaded") as Storyboard;
sb.begin(uc2);
content.Content = uc2;

期待どおりに動作します。変換アニメーションについては、上記に加えて も削除し、TransformGroup次のようになりました。

<Storyboard x:Key="Unloaded">
    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
        <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
        <EasingDoubleKeyFrame KeyTime="0:0:3" Value="-800"/>
    </DoubleAnimationUsingKeyFrames>
</Storyboard>

同じ方法で呼び出すと、次のエラーが発生します。

System.InvalidOperationException: ''[Unknown]' property does not point to a DependencyObject in path '(0).(1)[3].(2)'.'

問題を解決するには?

4

1 に答える 1