Highligting when draging & droping in gcc

Hello in the ggc, When draging and dropping i want to Highlight or change the backcolor of the current row (target) and the backcolor of the source row, i tried the following code but it''s not working private void grid_DragOver(object sender, DragEventArgs e) { GridGroupingControl grid = sender as GridGroupingControl; if(grid!= null) { GridTableControl tableControl = grid.TableControl; Point pt = new Point(e.X, e.Y); int row, col; if(tableControl.PointToRowCol(pt, out row, out col)) { GridTableCellStyleInfo style = tableControl.Model[row, col]; if(style.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell // .RecordRowHeaderCell || style.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell) { style.BackColor = Color.Yellow; grid.TableDescriptor.Appearance.AnyHeaderCell.BackColor = Color.Yellow; } } the other question taht i have is : How can i reference the RecordFieldCell and the AlternateRecordFieldCell of the nestedTables could you please help me with this. Thanks

5 Replies

AD Administrator Syncfusion Team December 1, 2005 05:32 PM UTC

You cannot set individual cell properties in a GridGroupingControl using an indexer. To set properties on a cell by cell basis, you need to use QueryCellStyleInfo. Here is a little sample. http://www.syncfusion.com/Support/user/uploads/GGC_DnD_5f40c779.zip Where do you want to reference records in a child table? Depending on where you are, there may be simpler ways. In general, you can try using this.gridGroupingControl1.GetTable("ChildTableName").Records to get at all records in a child table. There is also a FilteredRecords collection that gives you the visible records.


AD Administrator Syncfusion Team December 1, 2005 06:05 PM UTC

Thank you very much Clay, it''s works for referencing the Childtable, i mean : in the QueryCellStyleInfo when i want to modify the style of a RecordRowHeaderCell i use the condition : if(e.TableCellIdentity.TableCellType == GridTableCellType.RecordRowHeaderCell but what i want to modify is the RecordRowHeaderCell style of the nestedChilds Thanks >You cannot set individual cell properties in a GridGroupingControl using an indexer. > >To set properties on a cell by cell basis, you need to use QueryCellStyleInfo. Here is a little sample. >http://www.syncfusion.com/Support/user/uploads/GGC_DnD_5f40c779.zip > >Where do you want to reference records in a child table? Depending on where you are, there may be simpler ways. In general, you can try using this.gridGroupingControl1.GetTable("ChildTableName").Records to get at all records in a child table. There is also a FilteredRecords collection that gives you the visible records.


AD Administrator Syncfusion Team December 1, 2005 06:15 PM UTC

Try code like:
private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
	if((e.TableCellIdentity.TableCellType == GridTableCellType.RecordRowHeaderCell || 
		e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordRowHeaderCell)
		&& (e.TableCellIdentity.Table.TableDescriptor.Name == "ChildTable"))
	{
		e.Style.BackColor = Color.Red;
	}
}


AD Administrator Syncfusion Team December 1, 2005 07:44 PM UTC

Thank you always in the QueryStyleInfo how can i test someting like " if(e.TableCellIdentity.RowIndex == 5)" but this time for the nested tables >Try code like: >
>private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
>{
>	if((e.TableCellIdentity.TableCellType == GridTableCellType.RecordRowHeaderCell || 
>		e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordRowHeaderCell)
>		&& (e.TableCellIdentity.Table.TableDescriptor.Name == "ChildTable"))
>	{
>		e.Style.BackColor = Color.Red;
>	}
>}
>


AD Administrator Syncfusion Team December 1, 2005 08:05 PM UTC

I am not sure I understand what you want, but did you try adding the criteria to your rowindex condition? e.TableCellIdentity.Table.TableDescriptor.Name == "ChildTable")) Or, do you want to find the 5th row in the child table? If so, try adding a criteria like: e.TableCellIdentity.Table.TableDescriptor.Name == "ChildTable" && e.TableCellIdentity.Table.Records.IndexOf(e.TableCellIdentity.DisplayElement.ParentRecord) == 5

Loader.
Up arrow icon