Cell content spacing

2 posts, 0 answers
  1. Danijel
    Danijel avatar
    2 posts
    Member since:
    Jul 2013

    Posted 25 Jan Link to this post

    Hi,

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

  2. Lance | Tech Support Engineer, Sr.
    Admin
    Lance | Tech Support Engineer, Sr. avatar
    457 posts

    Posted 25 Jan Link to this post

    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
Back to Top