【发布时间】:2011-11-21 23:33:01
【问题描述】:
我在 sdk:DataGridCell 模板中寻找绑定 TextBlock 的正确方法; WPF 中的方式 - Text={Binding} 不起作用。
<Style TargetType="sdk:DataGridCell">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ContentControl">
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="MouseOver">
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border Background="{x:Null}">
<TextBlock Text="{Binding}" Foreground="Black"/>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content.Text}" 也不起作用。
还有其他想法吗?非常感谢。
【问题讨论】:
标签: silverlight templates binding datagrid