绑定数据表到ContentControl的内容

如何将文本框文本属性(在datatemplate内)绑定到ContentControl Content属性?

(不通过ElementName绑定)

How to bind textbox text property, within datatemplate, to ContentControl Content property?
(Without bindng via ElementName)

这是我的代码(这不工作):

This is my code( that doesn't work):

<Window.Resources>
    <DataTemplate x:Key="Temp">
       <TextBox TextWrapping="Wrap" Text="{TemplateBinding Content}" Height="20" Width="Auto"/>           
    </DataTemplate>
</Window.Resources>
<Grid>
    <ContentControl  ContentTemplate="{DynamicResource Temp}" Content="1"/>           
</Grid>




 1 条回答