How to manually create an App.xaml file in a WPF Python project in Visual Studio?

When we create a new WPF C # project from Visual Studio , we get 4 main files "App.xaml","App.cs","MainWindow.xaml","MainWindow.cs"

Here the App.xamlfile is mainly used to store application related Resourcesin a single file, which should be present throughout the application.

But when creating a WPF Python project in Visual Studio, we get only 2 files "MainWindow.xaml" and "MainWindow.py"

I want to create 2 more file in my Python project "App.xaml" and "App.py" so that "App.xaml"I can easily define all styles of resource related to applications, templates.

Help plz !!

+3
source share
1 answer

. Alt + S, . , "", " " .

, " " WPF , . App.xaml. , :

<Application x:Class="ManuallyCreatingAWpfProject.app"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Startup="AppStartup"
    >
  <Application.Resources>

  </Application.Resources>

</Application>

...

public partial class App : Application
{
    void AppStartup(object sender, StartupEventArgs args)
    {
        Window1 mainWindow = new Window1();
        mainWindow.Show();
    }
}

. Windows Presentation Foundation Project Visual Studio MSDN, .

( "" ) "" App.xaml "". , Build ApplicationDefinition App.xaml.

+5

All Articles