We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Virtual Grid issues

I have three issues in case of readonly virtual grid:

1) If I click on the empty area of the grid, the selection, if any, should be removed.
2) I want to always show an empty row at the end of the grid.
3) The back color of the grid (even the empty area) should be set to 'SystemColors.Window'. The BackColor on the grid doesn't help as the color of the empty area is still 'Control' color.

How do I fix the above issues? Thanks.

*Empty area refers to that part of the grid that is outside of all the cells.

1 Reply

AD Administrator Syncfusion Team December 29, 2006 04:49 AM UTC

Hi,

>>> 1) If I click on the empty area of the grid, the selection, if any, should be removed.
You can handle the Click event of the grid control and clear the selection using Model.Selection.Clear method when the empty area is clicked. Here is a code snippet

private void gridControl1_Click(object sender, EventArgs e)
{
GridControl grid = sender as GridControl;
Point pt = grid.PointToClient(MousePosition);
int row ,col;
grid.PointToRowCol(pt,out row,out col);
if( row > dt.Rows.Count || row == -1 || col == -1)
grid.Model.Selections.Clear(true);
}

>>>2) I want to always show an empty row at the end of the grid.
There is a property to control the display of the Empty rows in a grid. you can use below code to display empty rows in a grid

this.gridControl1.Model.Options.DisplayEmptyRows = true;

>>>3)The back color of the grid (even the empty area) should be set to 'SystemColors.Window'. The BackColor on the grid doesn't help as the color of the empty area is still 'Control' color.

Try setting the Properties.BackgroundColor to set the color of the area below the last row and right of last column inside the grid window.

this.gridControl1.Properties.BackgroundColor = Color.Red;

Please refer the attached sample for implementation.
VirtualGC.zip

Best Regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon