title: Passing argument to StartupUri in WPF
body: <p>I've got a simple WPF application with the usual static Main() (entry point to application). Main will do some initialisation stuff before the UI is displayed. It will then creating and run the start-up Window. However, what I need to do is pass a custom object from main to start-up Window but I'm not sure how to do it.</p>
  
  <p>My main class containing Main() looks like this:</p>
  
  <pre><code>class App : Application
  {
      [STAThread()]
      static void Main()
      {
          MyObject obj;
          // Some processing stuff here.
  
          new App(obj);
      }
  
      public App(MyObject obj)
      {
          StartupUri = new System.Uri("MainWindow.xaml", UriKind.Relative);
          Run();
      }
  }
  </code></pre>
  
  <p>Obviously, <code>MyObject</code> is my custom object that I would like to have access to in my start-up Window. How can I do this?</p>
  
  <p>TIA</p>