Code4Blog (VS 2010)
<Window x:Class="FirstTwitterApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Code4Blog (VS 2010)
<Window x:Class="FirstTwitterApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Code4Blog (VS 2010)
<Window x:Class="FirstTwitterApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="clr-namespace:FirstTwitterApp.ViewModels"
xmlns:local="clr-namespace:FirstTwitterApp"
Code Snippet plugin for Windows Live Writer
1: <Window x:Class="FirstTwitterApp.MainWindow"
2: xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3: xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4: xmlns:vm="clr-namespace:FirstTwitterApp.ViewModels"
5: xmlns:local="clr-namespace:FirstTwitterApp"
Follow Up. I discovered ReSharper can format XAML too. Details at the end.
This post describes how to set up Visual Studio 2010 to format “Attribute Hide & Seek” XAML like this
into the one-attribute-per-line format I prefer.
Adding the two formatting commands to the XAML editor context menu makes reformatting easy and convenient.
First, setup VS’s XAML format per this blog post (found via stackoverflow). Then reformat all or just the selected XAML from the Edit | Advanced submenu:
Notice that the menu commands are Format Document and Format Selection. The word “Format” is first in both.
Adding these commands to the XAML editor context menu was more of a hassle than it should have been, IMO. I looked for “Format Document” and “Format Selection” without success in all the Categories in the Add Command dialog. I found the commands quickly using the searchable Options / Keyboard dialog box. Note they are “Edit.Format*”.
However, in the UNsearchable, UNfilterable Add Command dialog they are inconveniently listed as “Document Format” and “Selection Format”.
Here is my updated popup menu shown on some XAML whose top line is about 3 monitors long. (I put Format Selection first because I think it will get used most often.)
I like the formatted XAML better.
ReSharper formats XAML with its (duh!) XML Formatting Style.
A keyboard shortcut to ReSharper _Silent Cleanup Code works well.