Developer technologies | Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
see the picture ,try to add the code to InitializeComponent or Main function , both no use, doesn't work
To execute a function at startup, add this attribute to App.xaml:
<Application
. . .
Startup="Application_Startup">
</Application>
Then define the function in App.xaml.cs:
public partial class App : Application
{
private void Application_Startup( object sender, StartupEventArgs e )
{
MessageBox.Show( "Hello!" );
}
}
Or use the events or constructor of the main window.
The .g.cs and .g.i.cs files are generated and overwritten by system and cannot be edited manually.