protected override void OnRenderCell(DrawingContext drawingContext, RowInfo rowInfo, CellInfo cellInfo)
{
var index = dataGrid.View.Records.IndexOfRecord(rowInfo.Record);
var rect = new Rect((cellInfo.CellRect).X, (cellInfo.CellRect).Y + 0.5, (cellInfo.CellRect).Width, (cellInfo.CellRect).Height);
if (index % 2 == 0)
drawingContext.DrawGeometry(new SolidColorBrush(Color.FromRgb(245, 245, 245)), new Pen(), new RectangleGeometry(rect));
//Colors.Bisque
if (index == -1 &&
rowInfo.Record is Group)
{
//Convet text to BOLD?????????? HOW?????
}
base.OnRenderCell(drawingContext, rowInfo, cellInfo);
}
protected override void OnDrawText(DrawingContext drawingContext, RowInfo rowInfo, CellInfo cellInfo, string cellValue)
{
double thickness = 0;
var contentrect = AddBorderMargins(cellInfo.CellRect, new Thickness(5, Math.Ceiling(thickness / 2), 5, Math.Ceiling(thickness / 2)));
FormattedText formattedText = GetFormattedText(rowInfo, cellInfo, cellValue);
var textalignment = TextAlignment.Left;
var textwrap = TextWrapping.NoWrap;
if (rowInfo.RowType == RowType.HeaderRow || rowInfo.RowType == RowType.StackedHeaderRow)
{
textalignment = TextAlignment.Center;
textwrap = TextWrapping.Wrap;
}
else if(cellInfo.ColumnName != "" && (rowInfo.Record is Group))
{
//-->here sets the Font weight as Bold for the Summary Row
formattedText.SetFontWeight(FontWeights.Bold);
}
else if (cellInfo.ColumnName != "" && !(rowInfo.Record is Group))
{
textalignment = GetColumnTextAlignment(cellInfo.ColumnName);
textwrap = GetColumnTextWrapping(cellInfo.ColumnName);
//-->Here we have applied the Foreground color for the record row
var index = dataGrid.View.Records.IndexOfRecord(rowInfo.Record);
if (index % 2 == 0)
formattedText.SetForegroundBrush(Brushes.Bisque);
}
if (contentrect.Width > 0 && contentrect.Height > 0)
{
formattedText.MaxTextWidth = contentrect.Width;
formattedText.MaxTextHeight = contentrect.Height;
formattedText.TextAlignment = textalignment;
if (textwrap != TextWrapping.NoWrap)
formattedText.Trimming = TextTrimming.None;
else
{
formattedText.Trimming = TextTrimming.CharacterEllipsis;
formattedText.MaxLineCount = 1;
}
drawingContext.DrawText(formattedText, contentrect.TopLeft);
}
} |