Skip to content

External Configurations

David Grochocki edited this page Dec 16, 2016 · 21 revisions

A valid XAML Styler configuration is a JSON file with one or more configuration options specified. Below is a complete external configuration that contains the default values. Set the External Configuration File option to the file path containing the JSON configuration. This path can be a local or network location.

####Default Configuration####

{
    "AttributesTolerance": 2,
    "KeepFirstAttributeOnSameLine": false,
    "MaxAttributeCharatersPerLine": 0,
    "MaxAttributesPerLine": 1,
    "NewlineExemptionElements": "RadialGradientBrush, GradientStop, LinearGradientBrush, ScaleTransfom, SkewTransform, RotateTransform, TranslateTransform, Trigger, Condition, Setter",
    "SeparateByGroups": false,
    "AttributeIndentation": 0,
    "AttributeIndentationStyle": 1,
    "RemoveDesignTimeReferences":  false,
    "EnableAttributeReordering": true,
    "AttributeOrderingRuleGroups": [
        "x:Class",
        "xmlns, xmlns:x",
        "xmlns:*",
        "x:Key, Key, x:Name, Name, x:Uid, Uid, Title",
        "Grid.Row, Grid.RowSpan, Grid.Column, Grid.ColumnSpan, Canvas.Left, Canvas.Top, Canvas.Right, Canvas.Bottom",
        "Width, Height, MinWidth, MinHeight, MaxWidth, MaxHeight",
        "Margin, Padding, HorizontalAlignment, VerticalAlignment, HorizontalContentAlignment, VerticalContentAlignment, Panel.ZIndex",
        "*:*, *",
        "PageSource, PageIndex, Offset, Color, TargetName, Property, Value, StartPoint, EndPoint",
        "mc:Ignorable, d:IsDataSource, d:LayoutOverrides, d:IsStaticText",
        "Storyboard.*, From, To, Duration"
    ],
    "FirstLineAttributes": "",
    "OrderAttributesByName": true,
    "PutEndingBracketOnNewLine": false,
    "RemoveEndingTagOfEmptyElement": true,
    "SpaceBeforeClosingSlash": true,
    "RootElementLineBreakRule": 0,
    "ReorderVSM": 2,
    "ReorderGridChildren": false,
    "ReorderCanvasChildren": false,
    "ReorderSetters": 0,
    "FormatMarkupExtension": true,
    "NoNewLineMarkupExtensions": "x:Bind, Binding",
    "ThicknessSeparator": 2,
    "ThicknessAttributes": "Margin, Padding, BorderThickness, ThumbnailClipMargin",
    "FormatOnSave": true,
    "CommentPadding": 2,
}

####Indent Size#### XAML Styler (plugin only) detects and uses Visual Studio indent options by default. However, since xstyler.exe runs independently of Visual Studio, we are unable to detect those options. If you want to override the default behavior for either the plugin or xstyler.exe, you can set an extra property "IndentSize" in an external configuration.

Default Value (plugin): Visual Studio options
Default Value (xstyler.exe): 2

Example:

"CommentPadding": 2

####Default Configuration Options####

  • AttributeIndentationStyle
  • Mixed = 0
  • Spaces = 1
  • RootElementLineBreakRule
  • Default = 0
  • Always = 1
  • Never = 2
  • ReorderVSM
  • None = 0
  • First = 1
  • Last = 2
  • ReorderSetters
  • None = 0
  • Property = 1
  • TargetName = 2
  • TargetNameThenProperty = 3
  • ThicknessSeparator
  • None = 0
  • Space = 1
  • Comma = 2