Reputation: 11
In Visual Studio 2022, I can create a WPF form in my C# Project (Masterclass.Revit.2023) but when I copy or move it to my Shared Project within the same solution it splits the .xaml into two separate files and the window is no longer visible. What I mean is the .cs file is no longer a subfile of the .xaml file, they are seen as two separate files. Furthermore, when I was following Konrad Sobon in a youtube video @ timestamp (2:37:17 video link is below) he can do it just fine and when I clone his file from GitHub it works just fine.
BadMoneys|AEC Tech 2021 https://www.youtube.com/watch?v=iS_d90bq6k0&t=7687s
Cloned File https://github.com/TheBIMsider/Masterclass
I tried creating the WPF user control form from my Shared Project its still spilts it into two files and as I said before I can create it in a C# Project it works like it should and the .cs file is a sub file of the .xaml file.
How can I get this form to be visible inside my Shared Project and the .cs file be a subfile of the .xaml file?
Upvotes: 1
Views: 152
Reputation: 532
This may not be the best solution, but you can create a new blank WPF File (Window or UserControl will not matter) in your Shared Project, This will create 2 Files, XAML with its sub-file .cs. Open the XAML Files in your Old project and in your Shared Project, Copy All XAML Lines from Old to Shared, then Open the .cs File in your Old and Shared Project, and Copy all lines from old to shared. Finally, check your namespaces in the shared project.
This should solve your issue.
Upvotes: 0