views:

114

answers:

0

I'm creating a reusable control that dynamically adds another templated control to its visual tree:

DashboardContainer (top-level "container" control) - DashboardItem (control that is dynamically added to a StackPanel in container)

DashboardContainer is already a templated control so its easy to copy/customize its template in Blend. But I also want to be able to create a copy of the DashboardItem template, then have DashboardContainer recognize/apply the custom DashboardItem template at run-time.

My workaround so far: adding a Style property to DashboardContainer, then leaving it up to the dev to set the style. This requires temporarily adding a DashboardItem to the project, editing a template copy, then setting the Style based on the new template (and then removing the actual DashboardItem instance). There has to be a better way?