Open the document and press CTRL + K,D. This formats an entire C#/XML/XAML document as per the formatting settings specified under Tools | Options | Text Editor for each of these language editors.