public override void InternalRender(RenderContext context) { if (_rowInfosDirty) { UpdateRowInfos(); _rowInfosDirty = false; } if (Active && HoverRow != null && HoverRow != SelectedRow && SelectionHoverBackground != null) { SelectionHoverBackground.Draw(context, HoverRow.RowBounds); } if (SelectedRow != null && SelectedRow.RowVisible && SelectionBackground != null) { SelectionBackground.Draw(context, SelectedRow.RowBounds); } base.InternalRender(context); }
private void RenderSelection(RenderContext context) { var bounds = ActualBounds; switch (GridSelectionMode) { case GridSelectionMode.None: break; case GridSelectionMode.Row: { if (HoverRowIndex != null && HoverRowIndex != SelectedRowIndex && SelectionHoverBackground != null) { var rect = Rectangle.Intersect(new Rectangle(bounds.Left, _cellLocationsY[HoverRowIndex.Value] + bounds.Top - RowSpacing / 2, bounds.Width, _rowHeights[HoverRowIndex.Value] + RowSpacing), context.View); SelectionHoverBackground.Draw(context, rect); } if (SelectedRowIndex != null && SelectionBackground != null) { var rect = Rectangle.Intersect(new Rectangle(bounds.Left, _cellLocationsY[SelectedRowIndex.Value] + bounds.Top - RowSpacing / 2, bounds.Width, _rowHeights[SelectedRowIndex.Value] + RowSpacing), context.View); SelectionBackground.Draw(context, rect); } } break; case GridSelectionMode.Column: { if (HoverColumnIndex != null && HoverColumnIndex != SelectedColumnIndex && SelectionHoverBackground != null) { var rect = Rectangle.Intersect(new Rectangle(_cellLocationsX[HoverColumnIndex.Value] + bounds.Left - ColumnSpacing / 2, bounds.Top, _colWidths[HoverColumnIndex.Value] + ColumnSpacing, bounds.Height), context.View); SelectionHoverBackground.Draw(context, rect); } if (SelectedColumnIndex != null && SelectionBackground != null) { var rect = Rectangle.Intersect(new Rectangle(_cellLocationsX[SelectedColumnIndex.Value] + bounds.Left - ColumnSpacing / 2, bounds.Top, _colWidths[SelectedColumnIndex.Value] + ColumnSpacing, bounds.Height), context.View); SelectionBackground.Draw(context, rect); } } break; case GridSelectionMode.Cell: { if (HoverRowIndex != null && HoverColumnIndex != null && (HoverRowIndex != SelectedRowIndex || HoverColumnIndex != SelectedColumnIndex) && SelectionHoverBackground != null) { var rect = Rectangle.Intersect(new Rectangle(_cellLocationsX[HoverColumnIndex.Value] + bounds.Left - ColumnSpacing / 2, _cellLocationsY[HoverRowIndex.Value] + bounds.Top - RowSpacing / 2, _colWidths[HoverColumnIndex.Value] + ColumnSpacing, _rowHeights[HoverRowIndex.Value] + RowSpacing), context.View); SelectionHoverBackground.Draw(context, rect); } if (SelectedRowIndex != null && SelectedColumnIndex != null && SelectionBackground != null) { var rect = Rectangle.Intersect(new Rectangle(_cellLocationsX[SelectedColumnIndex.Value] + bounds.Left - ColumnSpacing / 2, _cellLocationsY[SelectedRowIndex.Value] + bounds.Top - RowSpacing / 2, _colWidths[SelectedColumnIndex.Value] + ColumnSpacing, _rowHeights[SelectedRowIndex.Value] + RowSpacing), context.View); SelectionBackground.Draw(context, rect); } } break; } }