Is there a way to fade out and fade in the background image of a HubSection
in Windows 8.1 XAML/C# Control?
Actually I have this XAML-Code:
<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>
I want to fade out the background image each 10 seconds --> change the image --> fade in again.
I have tried this by using the following code lines:
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();
But this does not work. If the storyboard has completed the image will change but with no fading effects.
Is the HubSection.Background
not "animatable"?