1

I have a grid, where cells contain textblock. I want to add some padding to the text in the cells (to move them inline with the header texts), but it has no effect.

XAML:

<dg2d:DataGrid2DT.CellStyle>
    <Style TargetType="wpftoolkit:DataGridCell">
        <Setter Property="TextBlock.TextAlignment" Value="Left" />
        <Setter Property="TextBlock.Padding" Value="4, 4, 4, 4" />
        <Setter Property="TextBlock.VerticalAlignment" Value="Stretch"/>
        <Setter Property="TextBlock.HorizontalAlignment" Value="Stretch"/>
        <Style.Triggers>
            <Trigger Property="IsSelected" Value="True">
                <Setter Property="Background" Value="LightBlue"/>
            </Trigger>
        </Style.Triggers>
    </Style>
</dg2d:DataGrid2DT.CellStyle>

Whatever I set in the padding, it's always the same, see:

enter image description here

Why Padding does not work here?

EDIT: Thanks to Muds, the SOLUTION:

Set a padding on dataGridCells in WPF

Community
  • 1
  • 1
Zoli
  • 841
  • 8
  • 31

0 Answers0