tags:

views:

15

answers:

2

I am new to WPF. In winforms I used to create a presenter and new it up in the static main(). The presenter's constructor would be given a reference to to the main form before the form would be shown.

MainPresenter presenter = new MainPresenter(myform);
Application.Start(myform);

How can I do this in WPF? I noticed that App.xaml has a 'StartUri' property that specifies which form to load. Where is the main entry point to a WPF application and how do I change the default behavior here?

Thanks!

A: 

You could do this in the constructor or Loaded event of either the main form (specified in startUri) or in the App.xaml.cs file

Rob Fonseca-Ensor
A: 

This post demonstrates what I needed perfectly.

http://www.developingfor.net/wpf/accessing-command-line-arguments-in-wpf.html

Startup="Application_Startup"

This was added in the App.xaml Application declaration.

I then wired the event in the App.xaml.cs

private void Application_Startup(object sender, StartupEventArgs e)
        {

        }

This helped a lot too:

http://social.msdn.microsoft.com/forums/en-US/wpf/thread/e5757d5c-28f3-4233-8a5f-00116587d5c7

Nick