Search This Blog

Friday, October 14, 2011

Silverlight DataGrid custom style desynchronized header and body columns; Silvelight DataGrid out of place

The problem lies in editing DataGrid style. When you wrap:

<sdk:DataGridCellsPresenter  Name="CellsPresenter"  />

with a border the header in not synchronized with the body of the grid anymore. The simple solution to this problem is to move:

sdk:DataGridFrozenGrid.IsFrozen="True"

from the Cells presenter to the most outer element you wrap the grid body with. Complete solution with Grid border looks like this:

<!-- CellPresenter content part -->
<Border BorderBrush="Black" BorderThickness="0.25" Controls:Grid.Column="1" sdk:DataGridFrozenGrid.IsFrozen="True">
    <sdk:DataGridCellsPresenter  Name="CellsPresenter"  />
</Border>

No comments:

Post a Comment

If you like this post, please leave a comment :)