title: XAML Storyboard for Background ImageBrush
body: <p>I have the following XAML Grid:</p>
  
  <pre><code> &lt;Grid Style="{StaticResource LayoutRootStyle}" x:Name="mainGrid"&gt;
      &lt;Grid.Resources&gt;
          &lt;Storyboard x:Name="FadeOut"&gt;
              &lt;DoubleAnimation Duration="3" To="0.0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="gridBackgroundImageBrush" d:IsOptimized="True"/&gt;
          &lt;/Storyboard&gt;
          &lt;Storyboard x:Name="FadeIn"&gt;
              &lt;DoubleAnimation Duration="3" To="0.35"  Storyboard.TargetProperty="Opacity" Storyboard.TargetName="gridBackgroundImageBrush" d:IsOptimized="True"/&gt;
          &lt;/Storyboard&gt;
      &lt;/Grid.Resources&gt;
  
      &lt;Grid.Background&gt;
          &lt;ImageBrush x:Name="gridBackgroundImageBrush" ImageSource="{Binding BackgroundImage}" Opacity="0.35"&gt;
          &lt;/ImageBrush&gt; 
      &lt;/Grid.Background&gt;
  </code></pre>
  
  <p>I want to programmatically start the "FadeOut" animation and change the Image from ImageBrush, then start the "FadeIn" animation, like this:</p>
  
  <pre><code>private void t_Tick(object sender, object e)
      {
          try
          {
              FadeOut.Begin();
              this.DefaultViewModel["BackgroundImage"] = BackgroundImage;
              FadeIn.Begin();
          }
          catch { }
      }
  </code></pre>
  
  <p>However the image is changing without any animation. I guess the problem is about how I'm accessing the "Opacity" property of the ImageBrush. I tried the following syntax for the 
  TargetProperty attribute:</p>
  
  <pre><code>(Control.Background).(ImageBrush.Opacity)
  </code></pre>
  
  <p>as msdn shows here: <a href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.media.animation.storyboard.settargetproperty.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.media.animation.storyboard.settargetproperty.aspx</a> but it doesn't seem to work. Can someone help me with this problem?</p>