Sometimes you need to re-create a project. And you copy source codes (partially) from old. So, let's say, let's say the forms are different (UserControl, Window ...). They respectively as usual consist of .xaml and .xaml.cs files. I add them to the project, but they appear as scattered files. They are not as one form. How to make that how they are added by default when creating one form were? Here is the screen: https://www.dropbox.com/s/zt1ph8fwl1vn3v5/screen.png?dl=0

    2 answers 2

    In the csproj project file:

    <Page Include="MainWindow.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> <Compile Include="MainWindow.xaml.cs"> <DependentUpon>MainWindow.xaml</DependentUpon> <SubType>Code</SubType> </Compile> 

      Yes, it seems you just need to add the xaml file to the project, and the studio will automatically pull up xaml.cs. Well, by itself, both files should be nearby.