title: Indentation with XDocument
body: <p>I am trying to do some bulk changes to a lot of XAML files and i ry to do this by aditing them using linq's XDocument.This is working fine and i am able to add new elements however i have problems with the indentation:</p>
  
  <p>the document is loaded with "PreserveWhitseSpace" because i need to keep the formatting (because of SVN):</p>
  
  <blockquote>
    <p>_xamlDocument = XDocument.Load(new StringReader(newContent), LoadOptions.PreserveWhitespace);</p>
  </blockquote>
  
  <p>then i add some elements, and when i'm done i save the file using:</p>
  
  <blockquote>
    <p>_xamlDocument.Save(stringWriter, SaveOptions.None);</p>
  </blockquote>
  
  <p>the newly added elements are not nicely indented, which does not look very nice (sorry for the formatting here but you'll see the /n strings):</p>
  
  <pre><code>&lt;?xml version=\"1.0\" encoding=\"utf-16\"?&gt;\r\n&lt;UserControl x:Class=\"Sonova.Chinook.UserInterface.Common.SimpleProgressView\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" Content=\"{Binding}\"&gt;\r\n    &lt;UserControl.Resources&gt;\r\n        \r\n    &lt;ResourceDictionary&gt;&lt;ResourceDictionary.MergedDictionaries&gt;&lt;ResourceDictionary Source=\"{ThemeDictionary AssemblyName=Cocoon.UserInterface}\" /&gt;&lt;ResourceDictionary Source=\"/Cocoon.UserInterface;component/VisualResources/Controls/ContentControl.xaml\" /&gt;&lt;/ResourceDictionary.MergedDictionaries&gt;&lt;/ResourceDictionary&gt;&lt;/UserControl.Resources&gt;\r\n    &lt;UserControl.Style&gt;\r\n        &lt;StaticResource ResourceKey=\"SimpleProgressStyle\" /&gt;\r\n    &lt;/UserControl.Style&gt;\r\n&lt;/UserControl&gt;
  </code></pre>
  
  <p>the  above Xml shows that there are no line breaks or whitespaces for instance for the following element:</p>
  
  <pre><code>&lt;ResourceDictionary Source=\"{ThemeDictionary AssemblyName=Cocoon.UserInterface}\" /&gt;&lt;ResourceDictionary
  </code></pre>
  
  <p>I already tried to set disableformating as save option, but none seem to lead to the desired result.</p>
  
  <p>Any ideas?
  best regards</p>