title: Fading an Image - C# WPF
body: <p>I don't quite understand why it is so complicated as in a standard windows form the code below works just fine. But anyway.</p>
  
  <p>I am trying to just fade an image in, and then fade it back out. At the moment I can't even get it to fade in, I feel pretty dumb because I'm sure there is something I am doing wrong. The for loop works but the image opacity does not change until it gets to 99 and then it suddenly changes. Please help because this is driving me mad.</p>
  
  <pre><code>namespace WpfApplication2
  {
     /// &lt;summary&gt;
     /// Interaction logic for MainWindow.xaml
     /// &lt;/summary&gt;
     public partial class MainWindow : Window
     {
        public MainWindow()
        {
              InitializeComponent();
        }
  
        private void dispatcherTimer_Tick(object sender, EventArgs e)
        {
           for (int i = 1; i &lt;+ 100; i++)
           {
              Logo.Opacity = i;
              label1.Content = i;                       
           }
        }
  
        private void Button_Click(object sender, RoutedEventArgs e)
        {
           System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
           dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
           dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 10);
           dispatcherTimer.Start();
        }
     }
  }
  </code></pre>