How to Bind To Data within a Datatemplate of a ContentControl How to Bind To Data within a Datatemplate of a ContentControl wpf wpf

How to Bind To Data within a Datatemplate of a ContentControl


You need to bind the Content property of the ContentControl

<ContentControl Content="{Binding}" ContentTemplate="{StaticResource PersonTemplate}" />

This will set the DataContext of the ContentControl as Content of the control.

Setting only the ContentTemplate property is not enough. The ContentControl does not implicitly use its DataContext as Content.