title: WPF Fade Animation
body: <p>How would I make a control fade in/out when it becomes Visible. </p>
  
  <p>Below is my failed attempt:</p>
  
  <pre><code>&lt;Window x:Class="WadFileTester.Form1"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Name="MyWindow" Title="WAD File SI Checker" Height="386" Width="563" WindowStyle="SingleBorderWindow" DragEnter="Window_DragEnter" DragLeave="Window_DragLeave" DragOver="Window_DragOver" Drop="Window_Drop" AllowDrop="True"&gt;
      &lt;Window.Resources&gt;
          &lt;Style TargetType="ListView" x:Key="animatedList"&gt;
              &lt;Style.Triggers&gt;
                  &lt;DataTrigger Binding="{Binding Visibility}" Value="Visible"&gt;
                      &lt;DataTrigger.EnterActions&gt;
                          &lt;BeginStoryboard&gt;
                              &lt;Storyboard&gt;
                                  &lt;DoubleAnimation
                                      Storyboard.TargetProperty="Opacity"
                                      From="0.0" To="1.0" Duration="0:0:5"
                                      /&gt;
                              &lt;/Storyboard&gt;
                          &lt;/BeginStoryboard&gt;
                      &lt;/DataTrigger.EnterActions&gt;
                      &lt;DataTrigger.ExitActions&gt;
                          &lt;BeginStoryboard&gt;
                              &lt;Storyboard&gt;
                                  &lt;DoubleAnimation
                                      Storyboard.TargetProperty="Opacity"
                                      From="1.0" To="0.0" Duration="0:0:5"
                                      /&gt;
                              &lt;/Storyboard&gt;
                          &lt;/BeginStoryboard&gt;
                      &lt;/DataTrigger.ExitActions&gt;
                  &lt;/DataTrigger&gt;
              &lt;/Style.Triggers&gt;
          &lt;/Style&gt;
      &lt;/Window.Resources&gt;
      &lt;Grid&gt;
          &lt;ListView Name="listView1" Style="{StaticResource animatedList}" TabIndex="1" Margin="12,41,12,12" Visibility="Hidden"&gt;
          &lt;/ListView&gt;
      &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>