Generally, using FrameworkElementFactory is one of the ways to create DataTemplates at runtime. Alternatively, you can use XamlReader.Load() to create DataTemplates from strings, which might be the more powerful approach, but in my opinion it is more difficult to maintain. Both techniques should be equally viable for this scenario.
As for the code snippet that you sent, it looks good to me. You only have to add dt.Seal() before using it to initialize the HierarchyChildTemplate. Can you please confirm whether this change fixed things up?
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Telerik Feedback Portal
and vote to affect the priority of the items