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, , .