问题
Possible Duplicate:
No Main() in WPF?
This is the code for Main() in WPF programming.
[STAThread]
public static void Main()
{
Window win = new Window();
....
Application app = new Application();
app.Run(win);
}
However, when I tried to use VS2010 to make WPF Application.

I can't find the Main(), but public MainWindow()
.

Why is the Main() function hidden? How can I get the Main() when I use VS2010 WPF project?
回答1:
The entry point is in App.xaml.cs. In there you could also override the OnStartup and pass in the cmd line arguments, if thats what you were wanting to do.
As others have mentioned, the question here answers what you are after.
回答2:
It is in .\obj\BuildConfiguration\app.g.cs
You can easily navigate to it by opening app.xaml.cs and use the right combobox above the source code to select the (grayed = resides in another partial-class file) main method.
回答3:
Main() is generated during compilation.Find it in App.g.cs in obj/{Debug,Release} folder
来源:https://stackoverflow.com/questions/7946672/where-is-the-main-function-hidden-with-wpf-project-file-from-vs2010