|
//To enable the Selection for the grid
this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.One;
//To restrict the selection backcolor
this.gridGroupingControl1.TableOptions.ListBoxSelectionColorOptions =GridListBoxSelectionColorOptions.None;
//To avoid current cell on Selection
this.gridGroupingControl1.TableOptions.ListBoxSelectionCurrentCellOptions =GridListBoxSelectionCurrentCellOptions.HideCurrentCell;
//Event subscription
this.gridGroupingControl1.QueryCellStyleInfo += GridGroupingControl1_QueryCellStyleInfo;
//Event customization
private void GridGroupingControl1_QueryCellStyleInfo(object sender,GridTableCellStyleInfoEventArgs e)
{
if(this.gridGroupingControl1.TableControl.CurrentCell.HasCurrentCellAt(e.TableCellIdentity.RowIndex) && e.TableCellIdentity.ColIndex > 0)
{
//Draw the Top and Bottom borders for all the cells.
e.Style.Borders.Top = new GridBorder(GridBorderStyle.Solid, Color.Black,GridBorderWeight.Thin);
e.Style.Borders.Bottom = new GridBorder(GridBorderStyle.Solid, Color.Black,GridBorderWeight.Thin);
if (e.TableCellIdentity.ColIndex == 1)
{
//Draw laft border for the first cell
e.Style.Borders.Left = new GridBorder(GridBorderStyle.Solid, Color.Black,GridBorderWeight.Thin);
}
if (e.TableCellIdentity.ColIndex == this.gridGroupingControl1.TableDescriptor.Columns.Count)
{
//Draw right border for the last cell
e.Style.Borders.Right = new GridBorder(GridBorderStyle.Solid, Color.Black,GridBorderWeight.Thin);
}
}
} |
if (e.TableCellIdentity.ColIndex == this.gridGroupingControl1.TableDescriptor.Columns.Count + 1 ) { //Draw right border for the last cell e.Style.Borders.Right = new GridBorder(GridBorderStyle.Solid, Color.Black,GridBorderWeight.Thin); } |
The issue I still have is that, when I select the row, it is selected in black!
If I comment the line:
| this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.One; |
It does not make a black selection, but it does select the cell. Here an image of the row completely black: https://ibb.co/b3if9w
Is there something wrong with my code? (i've posted the link above)
|
//To disable the currentcell on selection
this.gridGroupingControl1.TableOptions.ListBoxSelectionCurrentCellOptions =GridListBoxSelectionCurrentCellOptions.None; |