Custom application class

When I create a Wpf project, I get the default class Appthat is derived from Application I want to get Appfrom my own class (which, of course, inherits Application), but there is an auto- generated file App.g.csthat determines what Appthe derived form is Application.

How to disable this auto-generated file

+3
source share
2 answers

Change the tag <Applicationin App.xaml to<local:YourClass xmlns:local="clr-namespace:Your.Namespace"

Alternatively, get rid of App.xaml and create the whole class yourself.

+6
source

When creating your own class derived from the application, set the assembly action to ApplicationDefinition:

" XAML, ( XAML, ). ApplicationDefinition , Install is true, OutputType - winexe. WPF , , MSBuild ApplicationDefinition."

msdn

.g.cs, "ApplicationDefinition" "" .

+3

Source: https://habr.com/ru/post/1795781/


All Articles