VS2010中的WPF项目文件隐藏的Main()函数在哪里? [英] Where is the Main() function hidden with WPF project file from VS2010?

查看:140
本文介绍了VS2010中的WPF项目文件隐藏的Main()函数在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
在WPF中是否没有Main()?

Possible Duplicate:
No Main() in WPF?

这是WPF编程中Main()的代码.

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);
}

但是,当我尝试使用VS2010制作WPF应用程序时.

However, when I tried to use VS2010 to make WPF Application.

我找不到Main(),但是找不到public MainWindow().

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

为什么要隐藏Main()函数?使用VS2010 WPF项目时如何获取Main()?

Why is the Main() function hidden? How can I get the Main() when I use VS2010 WPF project?

推荐答案

入口点位于App.xaml.cs中.在那儿,您也可以覆盖OnStartup并传入cmd行参数,如果那是您想要的话.

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.

这篇关于VS2010中的WPF项目文件隐藏的Main()函数在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆