我刚刚开始WPF
。我从后面的代码分配startupURI
页面。它给我这个错误:找不到资源'application_startup'
Cannot locate resource 'application_startup'"
这里是我在App.xaml中做
<Application x:Class="HelloWpf.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="Application_Startup">
<Application.Resources>
</Application.Resources>
以下是我在App.xaml.cs文件已完成:
private void Application_Startup(object sender, StartupEventArgs e)
{
// Create the startup window
MainWindow wnd = new MainWindow();
// Do stuff here, e.g. to the window
wnd.Title = "Something else";
// Show the window
wnd.Show();
//Application.Current.MainWindow = wnd;
//wnd.InitializeComponent();
//wnd.Show();
}
请帮助这个简单的代码有什么问题。谢谢
事件名称是'Startup',而不是'StartupUri'(即一个属性)。正确订阅处理程序:'Startup =“Application_Startup”' – ASh
that worked.thanks .. –