You can not. At least not the way you are trying.
To quote this SO post about x: Key (highlighted by me):
x:Key used for elements that are added as values ββfor the dictionary, most often for styles and other resources that are added to the ResourceDictionary. When setting the x: Key attribute, there is actually no corresponding property on the object or even a set dependency property. It is simply used by XAML to find out which key to use when calling Dictionary.Add.
StaticResources are evaluated at boot time, so as soon as the control loads, the Template property is no longer bound to the binding, but instead is set to a ControlTemplate copy from your resources, and no corresponding property is set on this object.
You can verify this by checking the XAML buttons after loading, using something like XamlWriter.Save to view its XAML line.
The only solution I can think of could work is to skip your .Resources and find a ControlTemplate that equals your Button ControlTemplate . I have not tested this, and it is probably not very practical for large resource libraries, but it might be an option.
But the best solution would probably be to change your logic, so the key value can be accessed in some other way by any object that it needs.
source share