Recently I have noticed that most of the code examples on MSDN are missing vital formatting characters such as spaces and newlines.
For example, this page on the Setter.TargetName property has some example XAML but it is not formatted, and there are no spaces between element names and attributes:
<Stylex:Key="Slider_Thumb"TargetType="{x:Type Thumb}"><SetterProperty="OverridesDefaultStyle"Value="true"/><SetterProperty="Width"Value="14"/><SetterProperty="Height"Value="14"/><SetterProperty="Template"><Setter.Value><ControlTemplateTargetType="{x:Type Thumb}"><GridWidth="14"Height="14"><EllipseFill="{TemplateBinding Foreground}"/><EllipseStroke="{TemplateBinding BorderBrush}"StrokeThickness="1"x:Name="ThumbCover"><Ellipse.Fill><LinearGradientBrushEndPoint="0,1"StartPoint="0,0"><LinearGradientBrush.GradientStops><GradientStopColor="#CCFFFFFF"Offset="0"/><GradientStopColor="#00000000"Offset=".5"/><GradientStopColor="#66000000"Offset="1"/></LinearGradientBrush.GradientStops></LinearGradientBrush></Ellipse.Fill></Ellipse></Grid><ControlTemplate.Triggers><TriggerProperty="IsDragging"Value="true"><SetterTargetName="ThumbCover"Property="Fill"><Setter.Value><LinearGradientBrushEndPoint="0,1"StartPoint="0,0"><LinearGradientBrush.GradientStops><GradientStopColor="#CCFFFFFF"Offset="1"/><GradientStopColor="#00000000"Offset=".5"/><GradientStopColor="#66000000"Offset="0"/></LinearGradientBrush.GradientStops></LinearGradientBrush></Setter.Value></Setter></Trigger></ControlTemplate.Triggers></ControlTemplate></Setter.Value></Setter></Style>
Is anybody else having this problem, and is there anything I can do about it?
Enable
Auto-Formatting eventin your VS forpaste from clipboard(Tools -> Options) –It will format your xaml as soon you paste code in your XAML file but you need to fix some spacing issues manually.