Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 Winforms 中,您只有 Main 函数,这是首先运行的函数,但在 WPF 中,您可以在 Application.xaml 文件中设置要开始的窗口。如果我尝试运行除窗口以外的任何东西,我会怎么做?我正在移植一个 winforms 应用程序,该应用程序在开始时执行一些逻辑以确定要打开哪个窗口,我宁愿它只是一个运行的类,而不是一个永远不会出现的窗口。
删除StartupUrifrom App.xaml,覆盖OnStartupin App.xaml.cs。
StartupUri
App.xaml
OnStartup
App.xaml.cs