HubSection
Windows 8.1 XAML/C# コントロールの背景画像をフェードアウトおよびフェードインする方法はありますか?
実際、私はこのXAMLコードを持っています:
<HubSection x:Name="Section0" Width="700" Margin="0,0,80,0" VerticalContentAlignment="Bottom">
<HubSection.Background>
<ImageBrush x:Name="Section0Background" ImageSource="/Assets/images/img1.jpg" Stretch="UniformToFill" />
</HubSection.Background>
<!--... some other markup ... -->
</HubSection>
10秒ごとに背景画像をフェードアウトしたい->画像を変更->再びフェードイン。
次のコード行を使用してこれを試しました。
Storyboard storyboard = new Storyboard();
DoubleAnimation animation = new DoubleAnimation();
animation.From = 1.0;
animation.To = 0.0;
animation.BeginTime = TimeSpan.FromSeconds(0);
animation.Duration = new Duration(TimeSpan.FromMilliseconds(200));
storyboard.Children.Add(animation);
Storyboard.SetTargetProperty(animation, "Opacity");
Storyboard.SetTarget(animation, Section0Background);
storyboard.Completed += storyboard_Completed; // --> on complete change image and fade in
storyboard.Begin();
しかし、これはうまくいきません。絵コンテが完成すると、画像は変化しますが、フェード効果はありません。
「アニメート可能」ではありませんか?HubSection.Background