Use relative source binding:
Text="{Binding RelativeSource={RelativeSource AncestorType=ContentControl}, Path=Content}"
Edit: I should probably point out that in terms of binding purposes this is equivalent to {Binding}
, since the DataContext
in the ContentTemplate
is Content
.
However, the binding directly to the DataContext
will not extend back to the DataContext
source, so the Content
ContentControl
will not change when using this binding (or the two-way {Binding .}
Match, which does not change anything, as far as I can tell).
source share