I’ve updated the following extensions for Visual Studio 2017:
XAML Power Toys for Visual Studio 2015 and Visual Studio 2017
Mole for Visual Studio 2017
I’ve added the following extensions for Visual Studio 2017:
Tame Visual Studio Editor Tool Tips
Just a grain of sand on the world’s beaches
I recommend that you use this better extension instead of mine: https://visualstudiogallery.msdn.microsoft.com/3ebde8fb-26d8-4374-a0eb-1e4e2665070c
I like to tuck my viewmodels beneath the view in the Visual Studio Solution Explorer. To me, it makes for nice organization and condenses the number of top level files I have to view in the Solution Explorer.
Most of my viewmodels have a one-to-one relationship with its view. For those that don’t, I don’t tuck them beneath.
I also like to name my views and viewmodels according to the pattern picture in this image. For me, it keeps things clean and consistent.
To tuck or nest a viewmodel under it’s corresponding view:
- Select the view and viewmodel file in the solution explorer
- Execute the ViewModel Tuck Away command
ViewModel Tuck Away will verify that:
- Two files have been selected in the Solution Explorer
- That one file has a .xaml file extension and contains the word “viewmodel”
- That one file has a .cs file extension and contains the word “view”
ViewModel Tuck Away will then tuck the selected viewmodel beneath the selected view.
During the execution of the command, the Visual Studio Status Bar text will be updated to reflect the success or failure of the command.
I wrote this to enforce naming standards at my work and home projects.
I know that some (many) may not like how the naming is enforced. No problem, the source is on GitHub (see Source below) and you can very easily modify it, rebuild the solution and double click on your new VSIX file.
ViewModel Tuck Away Command
You can execute the command in three ways:
- Use the Tools Menu, ViewModel Tuck Away
- Add the command to a Toolbar
- Provide a shortcut key for the command
By default the command is added to the Tools Menu:
To add the command to a Toolbar, right click the Toolbar and select Customize and then follow the numbers below. #1 select the Toolbar Radio Button. #2 select the Toolbar you want to add the command to. #3 click the Add Command button and the next dialog will appear.
Select the ViewModel Tuck Away Command, click OK, and then close the above dialog. The command will now be on the Toolbar.
If you want to you can also use the Tools, Options dialog to add a keyboard shortcut for the command. #1 select Keyboard. #2 search for “viewMo” #3 click the Press shortcut keys TextBox and then press the desired key combination. #4 click the Assign button and then OK the dialog.
Download from Visual Studio Gallery
The source for ViewModel Tuck Away for Visual Studio 2015 is here.
Hope this helps someone and have a great day
Just a grain of sand on the worlds beaches.