This can be done by manually editing the .csproj file. But the easiest way is to simply copy the text of the .xaml and .xaml.cs files, delete them, add a new window through Visual Studio, and replace the generated text with the saved one.
If you really want to dig into .csproj, the element describing the dependent .xaml.cs file should look like this:
<Compile Include="MainWindow.xaml.cs"> <DependentUpon>MainWindow.xaml</DependentUpon> <SubType>Code</SubType> </Compile>
Pay attention to the DependentUpon part.
And do not forget to unload Visual Studio at the time of editing the project.
MainWindow, and in the secondMainWindows, it should be without "s" - Bulson