Instead of setting the DataContext
, you should set the Content
:
<ContentPresenter Content="{Binding DataContext, RelativeSource={RelativeSource TemplatedParent}}"/>
This will ensure the appropriate DataTemplate
is resolved based on the type of the Content
.
HTH, Kent
Kent Boogaart
2009-10-10 09:27:18