Reputation: 2424
I am new to MVVM therefore I understand this is a beginner question but I have not found the answer so far.
But in the View project of a MVVM style, what are the steps to add a XAML file to the project. When the project is selected in the solutions Explorer and Add ->Item is selected then how do you make sure that a XAML file is added. or there is no magical way to do it and you just add a .CS file and then change the extention to XAML.
Thanks for any help or references to any URLs.
Upvotes: 7
Views: 31049
Reputation: 1
For me selecting the .xaml file is VS2022 solution explorer, viewing Properties, then changing the Build Action from "None" to "Page" resolved the issue.
Upvotes: 0
Reputation: 25
This works for me (VS 2022) Right-click project or use Project menu then click
Upvotes: -1
Reputation: 137
This works for me, copy the template into the folder for the user:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Xamarin\Xamarin\4.0.3.214\T\IT\Cross-Platform\Code
to
C:\Users\your name here\Documents\Visual Studio 2015\Templates\ItemTemplates\Visual C#
Original answer: http://damianblog.com/2016/04/08/vs2015-xaml-forms-xaml-missing/
Upvotes: -1
Reputation: 21
When I want to create a style file to be used on more than one Window I Add a "WPF/Resource Dictionary" and add it to the Window.Resources of the windows that will use it. Something like this below. Everything you want to put within the Window.Resources should be placed between the ResourceDictionary tags.
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary Source="scrollerDictionary.xaml"/>
</ResourceDictionary>
</Window.Resources>
Upvotes: 0
Reputation: 11216
Just right click the project, choose Add -> Window and that will add a new xaml file along with its corresponding .cs file.
Upvotes: 13