There is problem with the DataContext of children inside the GridView:
For some reason, the DataContext of the GridViewHeaderRow gets overwritten by a local value (of type System.Object). Therefore, the property is not inherited and it is not possible to bind to members of the GridView DataContext any more!
The value is overwritten in DataCellsPresenter.cs (the corresponding line marked bold), although I don't see any reason to do this:
For some reason, the DataContext of the GridViewHeaderRow gets overwritten by a local value (of type System.Object). Therefore, the property is not inherited and it is not possible to bind to members of the GridView DataContext any more!
The value is overwritten in DataCellsPresenter.cs (the corresponding line marked bold), although I don't see any reason to do this:
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
this.ItemsHost = this.GetTemplateChild("PART_ItemsHost") as Panel;
GridViewRow gridViewRow = this.RadRowItem as GridViewRow;
if (this.RadRowItem != null &&
this.RadRowItem.GridViewDataControl == null)
{
this.RadRowItem.GridViewDataControl =
this.RadRowItem.ParentOfType<
GridViewDataControl
>();
}
if (gridViewRow != null)
{
this.Item = gridViewRow.Item;
gridViewRow.EnsureDataCellsPresenterSize();
}
else if (this.RadRowItem is GridViewHeaderRow)
{
this.Item = new object();
}
else if (this.RadRowItem is GridViewFooterRow)
{
this.Item = this.RadRowItem.GridViewDataControl.AggregateResults;
this.TrackAggregatesChanges(this.RadRowItem.GridViewDataControl.AggregateResults);
}
else if (this.RadRowItem is GridViewGroupFooterRow)
{
this.Item = this.RadRowItem.Item;
}
// At the time that a Row is prepared we can't Sync because the CellsPresenter isn't created yet.
// Doing it here ensures that the CellsPresenter is in the visual tree.
this.SyncProperties();
this.SetFrozenColumnSplitterPosition();
}