Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
590
Cell border when centered
posted

I would like to have a cell border in my XamDataGrid and be able to center the text in my cells. However, when the cell contents are centered, the border is around my value instead of the cell border.

My XAML

<igDP:XamDataGrid BindToSampleData="True" >
 <igDP:XamDataGrid.Resources>
 <Style TargetType="{x:Type igDP:CellValuePresenter}">
 <Setter Property="HorizontalAlignment" Value="Center"/>
 <Setter Property="BorderThickness" Value="1"/>
 <Setter Property="BorderBrush" Value="#FFD5D5D5"/>
 Style>  igDP:XamDataGrid.Resources> igDP:XamDataGrid> 

And here's how the grid looks

I would like the border to be along the splits in my columns instead.

Thank You!

  • 590
    Verified Answer
    Offline posted

    Shortly after posting this I found the answer. I should be setting the HorizontalContentAlignment instead.

    <Setter Property="HorizontalContentAlignment" Value="Center"/>