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.
Unfortunately, activation email could not send to your email. Please try again.

Coverd Cell

Thread ID:

Created:

Updated:

Platform:

Replies:

14699 Jun 2,2004 01:06 PM Jun 2,2004 03:32 PM Windows Forms 3
loading
Tags: GridControl
Vivek
Asked On June 2, 2004 01:06 PM

I have few header cells (both in row and column) as covered cell. I need help to achieve the following. If a user click on one of the covered cell in column or row header I need to select all the column (based on covered cell) or all the rows (based on covered cell). Let me try putting an example: this.programGrid.Model.CoveredRanges.Add(GridRangeInfo.Cells(0,1,0,2)); this.programGrid.Model.CoveredRanges.Add(GridRangeInfo.Cells(0,5,0,7)); So if they click either on column 1 or 2 it should select both (1,2) columns. If they click one on the 5,6 & 7 column then it should select all three(5,6,7) columns. I think it should be doable but need little direction. Thanks

Administrator [Syncfusion]
Replied On June 2, 2004 01:59 PM

You can handle the SelectionsChanging event and adjust e.Range if the selection intersects a coveredcell. Here is a try at this.
private void gridControl1_SelectionChanging(object sender, GridSelectionChangingEventArgs e)
{
	if(!e.Range.IsEmpty && e.Range.IntersectsWith(GridRangeInfo.Row(0)))
	{
		GridRangeInfo range = e.Range.IntersectRange(GridRangeInfo.Row(0));
		range = this.gridControl1.CoveredRanges.FindRange(0, range.Left);
		if(!range.IsEmpty)
			e.Range = GridRangeInfo.Cols(range.Left, range.Right);
	}
}

Vivek
Replied On June 2, 2004 03:01 PM

Thanks. It is working except that it does not select “First” cell. If covered range is (0,5,0,7) then does not matter where I click (on column 5,6 & 7) it does not select cell[0,5]. I would appreciate your reply! Thanks

Administrator [Syncfusion]
Replied On June 2, 2004 03:32 PM

This is by design. When you select a range of cells, the current cell is not selected. If you do not want this behavior, you can handle CurrentCellActivating and cancel it if you are trying to activate a header cell.
private void gridControl1_CurrentCellActivating(object sender, GridCurrentCellActivatingEventArgs e)
{
	if(e.RowIndex == 0)
		e.Cancel = true;
}

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;