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.
Related
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:
I have been trying to get my head around the SDK API for visual studio for a while now. The problem is I know what I want/need to do. However I can not find a code example or API documentation anywhere that allows me to do what I want :(
I know its possible just I cant find documentation to show how.
I want to add another sidebar ribbon for all open files similar to how the breakpoint works (And many test add-ins for VS, NCrunch comes to mind...) that is blank as standard but when clicked allows some logic to be run to add a comment on that line.
Once added a Icon will be then displayed on that line allowing you to click the icon to view/edit the left comment. (The storage of this etc. is not a problem with the implementation I am doing) I just really need to know how to tell the API to add a new ribbon/side thing and plumb in the required logic :/
If this isn't possible I also had the idea of highlighting the word and again a icon popping up but that seems even more annoying to implement hence why I chose the side option if it is at all possible :/
Thanks in Advance to anyone who helps :D
The "sidebar ribbon" is called an editor margin. See Editor Extension Points.
Implement an IWpfTextViewMargin interface to define a margin. You must
also implement the IWpfTextViewMarginProvider interface to create the
margin.
When opening a Form in the Visual Studio Designer, the generated designer files' contents get mixed up randomly. This includes the files
Form.Designer.cs and
Form.resx
When using a version control system this is a real nightmare.
Is there a way (extension?) that sorts and cleans up all designer files before saving? This would solve most of my VCS related issues with WinForms, as it reverses all the shuffling the designer does.
This problem sure does make merging difficult - I understand your pain.
Read this previous SO post:
"Why does C# designer-generated code (like Form1.designer.cs) play havoc with Subversion?"
Basically you could create a tool to sort all the code alphabetically to give order to the random placement of code, but it is a hack and could involve a lot of pain itself. Personally I recommend changing your work practices to reduce this occurring.
Reduce time between merges
Limit access to a form to 1 developer at a time.
Merge under the guidance of the developer who made the change, as they will know better what looks ok.
Don't open the designer, if you are only making a "code change", ie nothing changes visually.
Undo changes to the designer file before merges, if you are 100% sure that you didn't change anything.
This is not a tip about automatically sorting Form.Designer.cs; however, it does help with avoiding merge help with all modifications made to Form.Designer.cs-files by Visual Studio.
Instead of (or in addition to) changing your work practices (by Jonathon Lee) and especially the constricting "Limit access to a form to 1 developer at a time" do:
Ensure the Form.Designer.cs-file is organized according to Visual Studio in a separate commit before you make the real changes.
Trigger a reorganization of the Form.Designer.cs-file by Visual Studio
(For me, moving a control from one cell in a TableLayoutPanel to an other and back again did the trick.)
Commit Visual Studio's changes and mark them as nothing changed.
Make your modifications to the Form
Trigger a reorganization of the Form.Designer.cs-file by Visual Studio
Commit your changes and describing your work.
Results:
This helps reviewers to distinguish changes to review from noise.
This eases merging:
either, your version control system detects that two commits have the same effect and one is enough and it can merge without conflicts;
or, you manually resolve the conflict by applying just one of the cleanup commits and discard the other.
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 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.