private void ParseTemplateElement ()
{
Type t = ResolveType ();
if (t == null)
throw ParseException ("Unable to find the type {0}", t);
object o = InstantiateType (t);
XamlObjectElement element = new XamlObjectElement (this, reader.LocalName, o);
OnElementBegin (element);
ParseElementAttributes (element);
string template_xml = reader.ReadInnerXml ();
FrameworkTemplate template = o as FrameworkTemplate;
unsafe {
template.SetXamlBuffer (ParseTemplate, CreateXamlContext (template), template_xml);
}
//
// ReadInnerXml will read our closing </ControlTemplate> tag also, so we manually close things
//
OnElementEnd ();
}