title: How can I slide my Silverlight 5 Window onto the screen?
body: <p>I have a Silverlight 5 OOB app.  I want to create 'toast'.  I don't want to use NotificationWindows because of the limitations.  </p>
  
  <p>I've tried creating an S5 Window and sliding it onto screen.  [Crude, but it's a start.]  If I use one button n my main window to trigger the creation and another to trigger the animation, it works.  If I put the animation into the first method, the Window just appears, sans animation.  Does anyone know how I can make this work.</p>
  
  <p>To recreate, inside the Grid in MainPage.xaml, add:</p>
  
  <pre><code>&lt;Button Content="Show" Height="23" HorizontalAlignment="Left" Margin="12,12,0,0"
          Name="show" VerticalAlignment="Top" Width="75" Click="show_Click" /&gt;
  &lt;Button Content="Move" Height="23" HorizontalAlignment="Left" Margin="12,41,0,0"
          Name="move" VerticalAlignment="Top" Width="75" Click="move_Click" /&gt;
  </code></pre>
  
  <p>Inside MainPage.xaml.cs, add:</p>
  
  <pre><code>    private Window toastWindow;
  
      private void show_Click(object sender, RoutedEventArgs e)
      {
          toastWindow = new Window();
          toastWindow.Width = 280;
          toastWindow.Height = 58;
          toastWindow.Left = 975;
          toastWindow.Top = 755;
          toastWindow.WindowStyle = WindowStyle.None;
          toastWindow.WindowState = WindowState.Normal;
          toastWindow.Content = new Toast();
          toastWindow.Show();
          toastWindow.Activate();
  
          //for (int i = 0; i &lt; 20; i++)
          //{
          //    toastWindow.Top = toastWindow.Top - 5;
          //    System.Threading.Thread.Sleep(25);
          //}
      }
  
      private void move_Click(object sender, RoutedEventArgs e)
      {
          for (int i = 0; i &lt; 20; i++)
          {
              toastWindow.Top = toastWindow.Top - 5;
              System.Threading.Thread.Sleep(25);
          }
      }
  </code></pre>
  
  <p>You'll also need a UserControl called Toast (in Toast.xaml) in which I gave the LayoutRoot Grid a Background colour so that it was obvious, even through the Start bar, with Width="300" Height="100".</p>
  
  <p>On the Silverlight 5 Properties page you'll need to Enable running application out of the browser and in the Out-of-Browser Settings set Require elevated trust when running outside the browser.</p>
  
  <p>If you run it and click Show you'll see the toast behind the Start bar/clock area.  If you click Move, it slides up.  If you uncomment the end of the show_Click method and run it again and click Show, it will appear in its final position without any sliding.</p>
  
  <p>Any ideas?</p>
  
  <p>P.S. Ultimately, I'm looking to be able to have multiple 'slices' on screen at any one time with independent life-spans.</p>