You might begin by opening the tools menu and selecting options followed by text editor. For each language, especially JavaScript and HTML and C# pay special attention to "new lines", the format choice (including insert attribute value quotes when typing), miscellaneous (including format HTML on paste) and make sure that you also set your preferences for both XML and XAML.
If, later, you find that you have code that is not formatted according to your specification, press ctrl -E. followed by D which instructs the Visual Studio editor to impose your formatting choices on the current document. For example with the settings that I have in my copy of Visual Studio the following code
<Canvas xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"><Canvas.Resources><Storyboard x:Name="myTimer" Completed="OnTimerCompleted" Duration="00:00:01.00" /></Canvas.Resources></Canvas>
ctrl-E, D
reformat the document to
<Canvas xmlns=http://schemas.microsoft.com/client/2007
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Canvas.Resources>
<Storyboard x:Name="myTimer"
Completed="OnTimerCompleted"
Duration="00:00:01.00" />
</Canvas.Resources>
</Canvas>