You can use the Razor Engine to do whatever you want in the templating subject. You can download from nuget (http://www.nuget.org/packages/RazorEngine) and without any setup configuration you can use the Razor syntax to do this. For example your template can be this:
<Window x:Class="<class>"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="@Model.Title"
Icon="@Model.Icon">
<Grid>
</Grid>
</Window>
Note: the @Model.Title and @Model.Icon thats come from Razor
Actually i use RazorEngine to all my templating task:
Email, Report generation on the fly (rdlc), etc…