0

i search fot the correct way to bind a TextBlock in the sdk:DataGridCell Template; the way like in WPF - Text={Binding} doesn't work.

<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>

Also Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content.Text}" doesn't work.

Any other ideas? Thanks a lot.

frank_funk
  • 183
  • 2
  • 3
  • 11

1 Answers1

0

Please see my answer here to a similar problem when you need to get out of the datagrid to get a parent datacontext. :

Silverlight - Access the Layout Grid's DataContext in a DataGrid CellTemplate's DataTemplate?

Hope this helps.

Community
  • 1
  • 1
Mario Levesque
  • 1,017
  • 13
  • 13