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

Problem with changing background color of Row

Hi

This problem relates to

Syncfusion.Windows.Forms.Grid.GridControl

I am using a tabBarSplitterControl and am dynamically adding a GridControl to a TabBarPage and the TabBarPage to the tabBarSplitterControl.

I am also subscribing to the CurrentCellActivated
event of the new GridControl

In this event I am using the following code

GridControl item = (GridControl)sender;
GridCurrentCell cc = item.CurrentCell;
GridStyleInfo style = new GridStyleInfo();
GridStyleInfo style1 = new GridStyleInfo();
style.BackColor = VoucherBackGroundColor;
style1.BackColor = Color.LightGray;
if (cc.MoveToRowIndex != cc.MoveFromRowIndex)
{
item.ChangeCells(GridRangeInfo.Cells(cc.MoveFromRowIndex, 1, cc.MoveFromRowIndex, 6), style);
item.ChangeCells(GridRangeInfo.Cells(cc.MoveToRowIndex, 1, cc.MoveToRowIndex, 6), style1);
}

I have tried simply to change the background color of the curent row of the GridControl by using
item.RowStyles[cc.MoveFromRowIndex].BackColor = VoucherBackGroundColor;
item.RowStyles[cc.MoveToRowIndex].BackColor = Color.LightGray;

but this has not worked also

I would like the background color of the current row in this grid to change on the user changing the row thru keyboard / mouse

Kindly Help

Thanks & Regards
Rahul

1 Reply

RH Rahul Hans April 16, 2007 12:37 PM UTC

Hi

I forgot to add that the GridControl is populated by populatevalues method and the source is a generic list.

Thanks Again
Rahul

>Hi

This problem relates to

Syncfusion.Windows.Forms.Grid.GridControl

I am using a tabBarSplitterControl and am dynamically adding a GridControl to a TabBarPage and the TabBarPage to the tabBarSplitterControl.

I am also subscribing to the CurrentCellActivated
event of the new GridControl

In this event I am using the following code

GridControl item = (GridControl)sender;
GridCurrentCell cc = item.CurrentCell;
GridStyleInfo style = new GridStyleInfo();
GridStyleInfo style1 = new GridStyleInfo();
style.BackColor = VoucherBackGroundColor;
style1.BackColor = Color.LightGray;
if (cc.MoveToRowIndex != cc.MoveFromRowIndex)
{
item.ChangeCells(GridRangeInfo.Cells(cc.MoveFromRowIndex, 1, cc.MoveFromRowIndex, 6), style);
item.ChangeCells(GridRangeInfo.Cells(cc.MoveToRowIndex, 1, cc.MoveToRowIndex, 6), style1);
}

I have tried simply to change the background color of the curent row of the GridControl by using
item.RowStyles[cc.MoveFromRowIndex].BackColor = VoucherBackGroundColor;
item.RowStyles[cc.MoveToRowIndex].BackColor = Color.LightGray;

but this has not worked also

I would like the background color of the current row in this grid to change on the user changing the row thru keyboard / mouse

Kindly Help

Thanks & Regards
Rahul

Loader.
Live Chat Icon For mobile
Up arrow icon