Changing the WPF Project Template Namespace

When I modify xaml cs, I will need to log in and manually modify the corresponding * .g.cs file. And it seems to overwrite it every time I rebuild.

So my question is: what is the correct way to change the namespace in a WPF application that was created by the WPF project template?

+3
source share
1 answer

Since .g.cs files are created from .xaml files, in addition to changing the namespace in the .xaml.cs files, you also need to change the namespace in the .xaml files.

For example, the main window in one of my projects is declared as follows in mainwindow.xaml:

<Window x:Class="Penov.Playground.MainWindow">

The corresponding mainwindow.xaml.cs file contains:

namespace Penov.Playground
{
    public class MainWindow
}

Penov.Playground, . .g.cs, , .

+11

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


All Articles