title: WPF Xaml MainWindow dissappears after its called using Show function
body: <p>I created a barebones WPF project in Microsoft Expression Blend 4.</p>
  
  <p>I then opened the project in Visual Studio 2012, and added a simple Class to the project.</p>
  
  <p>I Set the application properties to use this class as the Startup Object.</p>
  
  <p>I created a new mainwindow, and then used the show function for the object.</p>
  
  <p>The window pops up for a millisecond and then closes.</p>
  
  <p>How do I call the MainWindow so it so it stays open?</p>
  
  <p><b>Class1.cs</b></p>
  
  <pre><code>//This is the Class I created
  using System;
  using System.Collections.Generic;
  
  namespace WpfApplication5
  {
      static class Class1
      {
          [STAThread]
          static void Main()
          {
              MainWindow winMain = new MainWindow();
              winMain.Show();
          }
  
      }
  }
  </code></pre>
  
  <p><b>MainWindow.xaml.cs</b></p>
  
  <pre><code>//This is the Mainwindow.xaml.cs
  using System;
  using System.Collections.Generic;
  using System.Text;
  using System.Windows;
  using System.Windows.Controls;
  using System.Windows.Data;
  using System.Windows.Documents;
  using System.Windows.Input;
  using System.Windows.Media;
  using System.Windows.Media.Imaging;
  using System.Windows.Shapes;
  
  namespace WpfApplication5
  {
      public partial class MainWindow : Window
      {
          public MainWindow()
          {
              this.InitializeComponent();
  
          }
      }
  }
  </code></pre>
  
  <p><b>MainWindow.xaml</b></p>
  
  <pre><code>&lt;Window
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      x:Class="WpfApplication5.MainWindow"
      x:Name="Window"
      Title="MainWindow"
      Width="640" Height="480"&gt;
  
      &lt;Grid x:Name="LayoutRoot"/&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p><b>App.xaml</b></p>
  
  <pre><code>&lt;Application
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      x:Class="WpfApplication5.App"
      StartupUri="MainWindow.xaml"&gt;
      &lt;Application.Resources&gt;
  
      &lt;/Application.Resources&gt;
  &lt;/Application&gt;
  </code></pre>
  
  <p><b>App.xaml.cs</b></p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Configuration;
  using System.Data;
  using System.Windows;
  
  namespace WpfApplication5
  {
  public partial class App : Application
      {
      }
  }
  </code></pre>