Indentation - XAML - visual-studio-2010

Does anybody know how to do an auto-indent a XAML file in Visual Studio 2010?

With the document open, press
CONTROL+K CONTROL+D

Menu - Edit:Advanced:Format Document (Your keyboard shortcut will be to the right of the menu item)

I find that if I just close the current object using the auto-complete functionality Visual Studio will indent everything in-between.
So you could just delete the last line of your XAML and then just start retyping the start of the line, hit tab and get your XAML indented.
Or you could just select Edit > Advanced > Format Document.

Related

What's the purpose of this arrow icon in the left margin / breakpoint bar in Visual Studio? [duplicate]

What does the following arrow icon mean in the Visual Studio 2012 gutter window? I've never seen it before.
This particular line of code has nothing special about it, nor do I recall doing anything to this line that would cause an arrow to appear. It's definately attached to this line of code. Moving the line of code down causes the arrow to follow.
I have no add-ons installed in Visual Studio.
It marks a Task List shortcut. You add them with Edit > Bookmarks > Add Task List Shortcut, [Ctrl+E,T] keystroke. That adds an entry to the task list, use View > Task List to display it. Select "Shortcuts" in the combobox. You'll see a list of all the shortcuts you added. Double-click an entry to jump to the line.
Remove it again with Edit > Bookmarks > Remove Task List Shortcut, [Ctrl+E,T] again.
NOTE: In visual studio 2015 and above, its [Ctrl+K,Ctrl+H]

Visual Studio edit label text shortcut

Is there a shortcut in Visual Studio 2010 to jump into the Properties - Text field of the current selected item?
EDIT: Thank you Steve :)
It depends on your current keyboard layout, but if you press two times the key F4 with layout Visual C#2005 you get the editing inside the text property of the current label

Visual Studio shortcut for "quick fix"

Does Visual Studio 2010 have a shortcut for quick fix?
I'm tired of grabbing the mouse, hovering over this red line, waiting for the little clipboard icon to appear, clicking on the first menu item. It would be so much fast to just open that dialog with some keys and confirming the first (i.e. selected) item.
The feature is called the "Smart Tag".
Default Keyboard Shortcut Schemes (ReSharper documentation)
Stack Overflow question How does one set Visual Studio 2010 keyboard shortcuts comfortably, especially when using ReSharper?
Stack Overflow question Visual Studio keyboard shortcut to automatically add the needed 'using' statement
They can usually be invoked via the keyboard using either:
Ctrl+. (on a standard QWERTY keyboard)
Alt+Shift+F10 (if you've not got Function Lock enabled)
If your cursor is on the item that is underlined, you can use Ctrl + . to pop up the intellisence/suggestion context menu.
Alt + Shift + F10 does the trick.
Via #Rohit from Visual Studio keyboard shortcut to automatically add the needed using statement
If you want to edit the shortcut of quick fix you can do the following:
Open Tools->Options->Keyboard and in the Show commands containing field enter EditorContextMenus.CodeWindow.QuickActionsForPosition and replace the old shortcut with the new one.

Split button in a tool window toolbar

i'm writing a visual studio 2010 extension and got a ToolWindow with a ToolWindowToolbar.
in my toolbar i want to add a split button that while pressing the button (left part) will show the 'open file' dialog, and when pressing the arrow (right part) will show a list of recently opened files.
i have tried several ways to no avail, can you help?
This thread from MSDN Visual Studio Extensibility Forum might help you.
"Bitmap icon does not appear on a SplitDropDown button in Visual Studio toolbar"
see solution in this discussion

Show space, tab, CRLF characters in editor of Visual Studio

Where are the settings to show a space, tab, paragraph, CRLF, etc. (extended) characters?
Edit > Advanced > View White Space. The keyboard shortcut is CTRL+R, CTRL+W. The command is called Edit.ViewWhiteSpace.
It works in all Visual Studio versions at least since Visual Studio 2010, the current one being Visual Studio 2019 (at time of writing). In Visual Studio 2013, you can also use CTRL+E, S or CTRL+E, CTRL+S.
By default, end of line markers are not visualized. This functionality is provided by the End of the Line extension.
Edit -> Advanced -> View White Space or Ctrl+R,Ctrl+W for Visual Studio 2019
Display white space characters
Menu:
You can toggle the visibility of the white space characters from the menu:
Edit > Advanced > View White Space.
Button:
If you want to add the button to a toolbar, it is called Toggle Visual Space in the command category "Edit".
The actual command name is: Edit.ViewWhiteSpace.
Keyboard Shortcut:
In Visual Studio 2015, 2017 and 2019 the default keyboard shortcut still is CTRL+R, CTRL+W
Type one after the other.
All default shortcuts
End-of-line characters
Extension:
There is a minimal extension adding the displaying of end-of-line characters (LF and CR) to the visual white space mode, as you would expect. Additionally it supplies buttons and short-cuts to modify all line-endings in a document, or a selection.
VisualStudio gallery: End of the Line
Note: Since Visual Studio 2017 there is no option in the File-menu called Advanced Save Options. Changing the encoding and line-endings for a file can be done using Save File As ... and clicking the down-arrow on the right side of the save-button. This shows the option Save with Encoding. You'll be asked permission to overwrite the current file.
My problem was hitting CTRL+F and space
This marked all spaces brown. Spent 10 minutes to "turn it off" :P
The correct shortcut is CTRL-R-W like you don't have to release CTRL button while pressing W. This worked for me in VS 2015
For those who are looking for a button toggle:
The name of this command is View white space in GUI menu (Edit -> Advanced -> View white space).
The name of this command in the Add command popup is Toggle Visual Space.
If you use Visual Studio Code => View => Render Whitespace
That's it!
For me this setting was on, but didn't work. I had to turn it off and on again and than it worked! So this is a bug in Visual Studio Code!
If you use Visual Studio 2022 you can change the display options for whitespace etc. in Tools => Options => Text Editor => General and select "View whitespace"
The shortcut didn't work for me in Visual Studio 2015, also it was not in the edit menu.
Download and install the Productivity Power Tools for VS2015 and than you can find these options in the edit > advanced menu.
To see the CRLF you can try this extension: End of the Line
It works for VS2012+
For Visual Studio for mac, you can find it under Visual Studio -> Preferences -> Text Editor -> Markers and Rulers -> Show invisible characters
Please note you may need to restart Visual Studio for the changes to take effect
For completeness since I haven't seen it mentioned here, it is also in Options->Text Editor->General->View Whitespace.
In the actual version this Option ist under Editor: Render Whitespace

Resources