Summary of WPF Application entry functions (main function) in asp.net

Source: Internet
Author: User

The portal function for a Windows Forms application is in the Program.cs file, but where is the WPF application Portal function when the WPF application does not have this file? Add a portal function manually, build the project, and make an error:



The original WPF Application entry function is in the Objreleaseapp.g.cs file:

Program code

The code is as follows Copy Code

Public partial class App:System.Windows.Application {

<summary>
InitializeComponent
</summary>
[System.Diagnostics.DebuggerNonUserCodeAttribute ()]
[System.CodeDom.Compiler.GeneratedCodeAttribute ("PresentationBuildTasks", "4.0.0.0")]
public void InitializeComponent () {

#line 4 ". \.. \app.xaml "
This. StartupUri = new System.Uri ("MainWindow.xaml", System.UriKind.Relative);

#line default
#line hidden
}

<summary>
Application Entry point.
</summary>
[System.STAThreadAttribute ()]
[System.Diagnostics.DebuggerNonUserCodeAttribute ()]
[System.CodeDom.Compiler.GeneratedCodeAttribute ("PresentationBuildTasks", "4.0.0.0")]
public static void Main () {
Wpfapplication1.app App = new Wpfapplication1.app ();
App. InitializeComponent ();
App. Run ();
}
}

As you can see from the code, the StartupUri in the InitializeComponent method is used to specify the main form of the WPF application, and if you need to modify the main form is this a change here? No way! App.g.cs Note:

Reference content
//------------------------------------------------------------------------------
<auto-generated>
This code is generated by the tool.
Run-time Version: 4.0.30319.18052
//
Changes to this file may cause incorrect behavior, and if
The code is regenerated, and these changes will be lost.
</auto-generated>
//------------------------------------------------------------------------------

The WPF Application main form should be modified in the App.xaml file:

  code is as follows copy code
<application x:class=" Wpfapplication1.app "
              xmlns= "http://schemas.microsoft.com/winfx/2006/xaml/ Presentation "
             xmlns:x=" http:// Schemas.microsoft.com/winfx/2006/xaml "
              startupuri= "MainWindow.xaml"
    <application.resources>
         
    </application.resources>
</application
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.