Q:

Codebehind for ControlTemplate of lookless control? 

I'm writing a lookless control which uses the usual Generic.xaml to apply a default control template. 
This control template needs some codebehind in order to render itself (Mainly to respond to resize events), but I'm confused where the heck I'm supposed to put the code, and how I access the template from it. 
This code is for rendering this particular template only, so does not belong in the control itself.  
Can anyone give me a clue? 

A:

I have found an excellent link that solves this using an attached behaviour on the template to attach a ViewModel that provides the extra functionality.  This way the control itself remains completely unaware of any template specific logic:
http://www.scottlogic.co.uk/blog/colin/2010/08/developing-a-very-lookless-silverlight-radial-gauge-control/

