How to copy line in XAML editor? - visual-studio

In Visual Studio.NET when coding I constantly use (no selection) CTRL-C, CTRL-V to make a quick copy of a line.
Unfortunately this works differently in the XAML editor (it pastes the new line in the middle of the current line).
Does anyone know the hotkey to copy a line in XAML?

If you map the .xaml extension to the standard XML editor this problem will be solved along with others such as the poor performance of the XAML editor.
Tools / Options / Text Editor / File Extension

In the XAML editor in Visual Studio 2010 (and the Visual Studio 11 Developer Preview), copying and pasting a line has the expected behavior:
Invoking a copy when there is no selected text causes the entire current line to be copied.
A subsequent paste when there is no selected text will cause the copied line to be inserted above the current line.

Related

How to stop Visual Studio from putting extra newline at the end of a file on save

I'm using Visual Studio 2019, and when I save a file (a cs file for example) VS will put an extra newline at the of the file.
I need to stop this behavior, but what I have searched on the internet so far, was about visual studio code or editors other than Visual Studio.
What is the philosophy of putting an extra newline at the end of file?
According to this link, I need to make Advanced Save Options menu visible, and then click it and change line endings dropdown value from Current Settings to Windows (CR LF).

Why can't I save files in Sublime Text opened from Visual Studio?

I am using Visual Studio 2012 and Sublime Text 3 in Windows 7.
I set up Sublime Text 3 as an external editor using the steps outlined here.
The file correctly opens to the current line as expected, however if I try to save the file in Sublime Text I get this error:
EDIT: The files are all marked as read-only, although VS opens and saves them without incident. What can I do to remove the read-only flag when editing in ST?
Have you checked the line endings of the files after you edit them in sublime? make sure they are CR+LF
This may help fixing-sublime-text-2-line-endings

How can I prevent Visual Studio from scrolling down to the bottom of the file when pasting a snippet of text?

When inserting a copied text in Visual Studio 2010 via CTRL+V, the text is pasted, and VS automatically scrolls down to the bottom of the file.
I've encountered this at least for XAML and C# files.
Any ideas on how to de-activate this scrolling?
go to "options"-->"keyboard" and check if there is such a keyboard shortcut enabled.
You can try to reset this settings if you don't find.
This was happening on my VS 2019 only within CSS <style> tag. I've resolved it using the following setting:

Change EOL Character in Visual Studio

I’m sorry if this is a trivial question for you.
Is there any way to change the End of Line Character (EOL) character in Visual Studio 2010? I want to change it from Windows (‘\r\n’) format to UNIX (‘\n’) format.
Thanks
File / Save As ...
Save with Encoding... (press the arrow next to the Save button to see this option)
Choose appropriate EOL character from the Line endings drop-down list
Click somewhere in the code page. Go to File -> Advanced Save Options -> use the Line Endings Drop box to select the line ending you want on ALL of your output files (when using \n for EOL). This solution is written for Visual Studio 2008.
For doing this globally, Strip'em is an add-in for Visual Studio that will automatically convert the line-ending when saving a file. Works for VS 2008/2010/2012.

HTML Editor in Visual Studio 2008: how to break attributes to separate lines?

In Visual Studio 2008, I've used a nice feature in its XAML editor which breaks a line so that a control's attributes are automatically positioned on new lines: one attribute per line.
Is there a way to do the same for the HTML editor?
Thank you.
Oded, thank you very much! You gave me an idea on how to apply "one attribute per line" formatting to an ASP.NET document:
In Visual Studio 2008, right-click on the .aspx file in the Solution Explorer.
Select "Open With..".
Select "XML Editor". [Assuming that the XML Editor has been properly configured in Tools->Options prior to doing this.]
Edit -> Advanced -> Format Document.
This reformats the document so that each attribute is positioned in its own line, and all of them are nicely indented.
Of course, if I later reopen the same file in Web Forms Designer and format it again, it goes back to what it looked like before.
But for my purposes (easily finding the required attributes in a large file), this temporary solution is quite sufficient.
Once again, thank you very much!
Best regards,
Dmitriy

Resources