A: 

I think you need a TargetType="Grid" on your <ControlTemplate>:

<ControlTemplate x:Key="myWindowTemplate TargetType="Grid">

....

Also, Grid isn't a ContentControl so I don't think the ContentPresenter you put in the template will behave the way you expect - it could even be causing the error.

James Cadd
A: 

Actually, from the code you've posted, your TargetType should be Button because you're applying the template to button.

Jim Lynn