DataGridCell Template Content Presenter doesn't Work

Jan 3, 2010 at 1:32 PM


I would like to change the foreground and font-family of my datagrid cells but it doesnt work correctly. The change of margin in the contentpresenter works without any problem but all TextBlock changes do not appear.

<Style x:Key="DataGridCellStyle" TargetType="{x:Type dg:DataGridCell}">
      <Setter Property="Background" Value="Transparent" />
      <Setter Property="BorderBrush" Value="Transparent" />
      <Setter Property="BorderThickness" Value="0" />
      <Setter Property="Template">
              <ControlTemplate TargetType="{x:Type dg:DataGridCell}">
                   <Border Background="Transparent" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0" SnapsToDevicePixels="True">
                      <ContentPresenter TextBlock.Foreground="Red" Margin="4,1,5,1" SnapsToDevicePixels="True" ClipToBounds="True" />

Could someon help me, please?