This is a migrated thread and some comments may be shown as answers.

Cell content spacing

1 Answer 78 Views
DataGrid
This is a migrated thread and some comments may be shown as answers.
Danijel
Top achievements
Rank 1
Danijel asked on 25 Jan 2017, 10:47 AM

Hi,

how can I specificy content margin in respect to cell borders (regardless of column type)?  i.e. padding from Cell's POV.

1 Answer, 1 is accepted

Sort by
0
Lance | Manager Technical Support
Telerik team
answered on 25 Jan 2017, 05:04 PM
Hi Danijel,

You can edit the CellContentStyle of the column, then either change the Padding or Margin. As an example, here's a DataGridTextColumn's style:

<grid:DataGridTextColumn  >
    <grid:DataGridTextColumn.CellContentStyle>
        <Style TargetType="TextBlock">
            <Setter Property="Padding" Value="2,2,2,2"/>
            <Setter Property="Margin" Value="2,2,2,2" />
        </Style>
    </grid:DataGridTextColumn.CellContentStyle>
</grid:DataGridTextColumn>


If you also want to apply such a padding when the cell is being edited, you can update the CellEditorStyle as well.

<grid:DataGridTextColumn.CellEditorStyle>
    <Style TargetType="TextBox">
        <Setter Property="Padding" Value="2,2,2,2" />
        <Setter Property="Margin" Value="2,2,2,2" />
    </Style>
</grid:DataGridTextColumn.CellEditorStyle>


To see all of the Column types and what their target types are, go to this page in the documentation.

Regards,
Lance | Tech Support Engineer, Sr.
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
DataGrid
Asked by
Danijel
Top achievements
Rank 1
Answers by
Lance | Manager Technical Support
Telerik team
Share this question
or