MVVM Light Resharper Templates? - c#

Since mvvm-light's C# snippets will not show if I'm using resharper, and my google skills have failed me... Does anyone know where i can get a set of MVVM light specific templates for ReSharper? I've found a post from Laurent that says he's working on it, but I've not been able to find them, and the thought of building them all myself seems daunting.

I'm using MVVM Light and ReSharper. The snippets show up when I press CTRL+J.

simply type the shortcut of a snippet (for example: mvvminpc ) somewhere in your source code and press TAB TAB
Please make sure that the snippets are available and correctly installed. You could use the Visual Studio Code Snippet Manager (Tools -> Code Snippet Manager) for this purpose. Select the Language (eg. C# ) an then you should see a folder named MvvmLightCSharpSnippets which contains all MVVM Light Snippets.

Related

Where Are the Code Snippets for Dependency Properties

For WPF/C# where are all the default code snippets for things like Dependency Properties (wpfdp) or Routed Commands (wpfrc). I couldn't find these snippets listed anywhere in Visual Studio.
For a dependency property, use propdp.
You can find out all available snippets easily if you're using visual studio 2017:
Type a letter, for example a.
Click on the last icon at the bottom of the Intellisense Window.
This displays all available snippets.
Personally, I think it's wise to learn c# if you're trying to learn wpf. WPF has a notoriously tricky learning curve and you will want all the help you can get in the process. C# developers are much more active blogging and posting samples than VB. It's way easier to find C# help. Certainly in my area of the world it's also way easier to find work using c# than vb.
There's a snippet manager.
Press Ctrl+K, Ctrl+B and you get a window up.
They are organised by language.
You can write your own fairly easily, although the support in standard vs is pretty limited.
Some people particularly like resharper for it's macro snippet support.
Roslyn supports refactoring and some prefer that route for complicated snippet-like functionality.
But anyhow, take a look in there.
Under c# do you not see the snippets?
If not this could be an install issue.
Maybe you installed just for VB initially if you're moving to c#.
And as Xanimax said. Set routed command aside for now. Learn MVVM and pick one of the nuget packages intended to give you a more convenient way to define commands. I like mvvmlight.
The keyboard commands are propdp and propa. If you need to find them otherwise type in CTRL - X and the Insert Snippet dialog will pop up and you will be given the list of keyboard snippets to insert via folders:
The two you are interested in are in the NetFX30 folder and not the Visual C# folder:

Which WPF element was used for the Visual Studio code editor?

According to this post, Visual Studio was rewritten using WPF. I'm trying to figure out what Element is used for the code editor window (specifically C#, if there's a difference) but I can't figure out which element could have all of that functionality (obviously with a lot of extra work. But still...).
I want to know this is so that I can experiment writing my own little code editor. (Yes, I know a full-fledged editor is a very large project. I'm talking about a simple custom one.)
After a quick Snoop I can see that the base element is:
Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView so it is very much a custom job.
I don't know what access you can get to the libraries but there is documentation around the namespace here:
https://msdn.microsoft.com/en-GB/library/microsoft.visualstudio.text.editor.aspx

Does Microsoft Expression Blend leave any trace behind in the code?

I have inherited a code from a prev. employee of our company that I need to maintain. Since he has Microsoft Blend installed in his machine and chose a MVVM architecture to build the code, now I am wondering is there anywhere in the code, Xaml or somewhere that I might look and find out that Blend registered his name which may show UI is designed by Blend.
If so, then it's easier to continue and use this tool to make modifications to the code.
I know you might be asking, just go check the latest projects. But the situation is, the Blend is expired/unregistered and now I don't want to purchase or install a new trial to find out.
As #McGarnagle said, it dropped the dime and I remembered that any time I added something in Blend and built the project I needed to come back and Ctrl + K + D the code to fix the format/indentation.
However, the guy who generated the code might have corrected the formatting as he went forward with blend.
Thanks for the comment.

Components for WPF similar to the simplified Visual Studio

I would like to make a support plug-ins in my program.
For example in my program there are several tabs in one tab is the editor in which the code is written also in that tab has a button run.
After pressing the button run occurs a compilation of source code and its execution.
The results of work are displayed in the other tab.
I would like to find such a component in which there are:
Syntax Highlighting, Debugger, Analogue of solution explorer
Thank you very much for your answers.
I would like to bring more of clarity to my question.
I want to do something similar to that is shown in the screenshots below
On a single tab there is the editor and at the other tab displays the results.
To write plug-ins I'd like to use C #.
I guess the best place to start is AvalonDock from CodePlex, specifically what you are trying to do is a Tabbed User Interface.
Keep in mind that even with a TabbedWindows framework build/debug and syntax highlighting are not for free and you will have to find icons and design the UI mostly yourself.
for code coloring there are also many components, also free, like Scintilla .NET
You obviously understand that Visual Studio is a very complex application, so rewriting portions of it will be difficult. There are components available to help you, like the ICSharpCode text editor. In fact, that whole project is probably quite valuable.
However, when thinking of plugins and actually writing code for it, I'd personally go down the MEF route. In fact, this is the very framework that VS.NET 2010 uses for extensibility. Provide your user/developer with a set of libraries to code against (like an SDK), and let them use a Visual Studio Express edition to write proper code :)
As source code editor you can use AvalonEdit (it is great, in some aspects even better than VS code editor), solution explorer is fairly easy to create and debugger is way too language-specific to be a reusable component (you didn't specify what language are you developing for!).
The whole thing can be packaged into AvalonDock, so you get the draggable and dockable panels - it even has VS 2010-like skin (and again - is very easy to implement even with only very basic WPF knowledge).
Or you can use the Visual Studio Isolated Shell - it allows you to use the Visual Studio interface in your program (the end users don't have to have VS installed!), but it requires extensive knowledge of VS API (if you ever developed VS extension you know what I am talking about). For example Civilization V used this approach for it's modding environment, but the result smells as stripped VS with custom splash screen, not as professional product. There are many buttons and config. options that don't work, some features that would be expected from such program (and easy to do in custom app) didn't get in because it would be nigh impossible to implant them into the VSIS etc...
EDIT: You may also eventually be interested in this.

How to display a form inside another form like Visual Studio

How does Visual Studio and other similar programs display a form in their IDE?
Is it possible to achieve the same or a similar effect using C# or VB.NET?
Please see the picture below to get what I mean.
If you are talking about hosting a Winforms editor in your code, it is entirely possible and is actually built in to the .NET framework!
The Essence is the IDesignerHost interface. The whole system is complicated, but can be done (I have done it in production code for runtime layout configuration editing). There is a sample of code from Microsoft here.
I'm sure if you search fir 'IDesignerHost' you'll find enough reference material to figure it out.
Are you speaking about UI creating tools?
Refer to http://www.icsharpcode.net/opensource/sd/ - SharpDevelop for deep dive. It's open sourse, so you'll be able to find out more details.
I believe what you want is a multiple document interface (MDI) see http://msdn.microsoft.com/en-us/library/ms973874.aspx for more info.

Categories

Resources