public void RegisterDataTemplate(DataTemplate template, DataTemplateInfo info)
 {
     // _datatemplates[key] = info;
     _templatesinorder.Add(info);
 }
        private void EmitRegisterDataTemplate(DataTemplateInfo info, string contextid = null, bool noresourcekey = false)
        {
            contextid = contextid ?? info.ContextID;

            string resourcekey = null;
            if (!noresourcekey)
            {
                resourcekey = info.ResourceKey as string;
            }

            if (Log.ShowTemplates)
            {
                Log.Trace("[EmitRegisterDataTemplate] {0,-30} {1,-30} {2,-20} {3:X8} -> {4}", info.TypeName, contextid, resourcekey, info.Control.GetHashCode(), info.Key);
            }

            Declarations.WriteLine("TemplateFactory.registertemplate(" +
                QuoteString(info.TypeName) + ", " +
                QuoteString(contextid) + ", " +
                QuoteString(resourcekey) + ", " +
                info.Key + ");");
        }