public class TheItemTemplate : ITemplate
{
//....
public void InstantiateIn(Control container)
{
//...
}
}
Who calls this method? And when is it called?
public class TheItemTemplate : ITemplate
{
//....
public void InstantiateIn(Control container)
{
//...
}
}
Who calls this method? And when is it called?
Typically, this method is called when the control tree is created, so in the CreateChildControls()
method. This CreateChildControls
method is part of the Control inheritance hierarchy and is typically overriden by subclassed controls.
So, the control to which the template belongs should call InstantiateIn()
in CreateChildControls
.