This is what I see in the solution explorer (simple wpf project):

This is what I would like to have:

There are two files dependent of the MainWindow.xaml
The obvious drag & drop of MainWindowViewModel.cs to MainWindow.xaml yields an error
can’t move file. Same destination
folder.
How can I achieve this? Should be simple, but I can’t find it …
Thanks for any hints
You can do that from within visual studio as far as i know. You can however manually edit the .csproj file and modify the
Compile Includeelement for your viewmodel like this:I havent actually done this in practice but it should get you what you want. However beware that visual studio might think thats is a generated file and delete it when you save the xamlfile, so make sure you backup your work before trying
-edit-
Did a quick test and it seems to work, visual studio doesnt seem to mind or interfere either.