Set context of template method to layout instance