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

"Global" RowHeight, "SelectionMode" and Cell-State

Hello,

I have some questions which I was not able to figure out by studying the Dashboard-Samples...(may be I've just ovelooked something):

1.) I want to set the RowHeight-Property for all rows in the GDBG at once. Is there a "global" Property to do it or do I have to loop through all Rows somehow?
2.) How can I prevent the RowHeight from being resized by mouse?
3.) How can I know the state of a particular Cell (while Drawing) -> is MoseHover, is it contained in the current Selection...
4.) If user clicks somewhere in the Grid I want to find out which Cell was hit and to which Row it belong, then I want to mark the whole Row as selected (a kind of "Only whole Rows can be selected" - mode). It shall be also possible to select multiple Rows by clicking around and holding the Shift-Key pressed. Is there some "SelectionMode"-Property available in GDBG?

Greetings



1 Reply

RC Rajadurai C Syncfusion Team October 30, 2008 01:25 PM UTC

Hi Silver,

Thanks for your interest in Syncfusion products.

Please find below the solutions for your queries.

1) To set the row height for all rows, you can use DefaultRowHeight property.

this.gridDataBoundGrid1.DefaultRowHeight = 50;

2) To stop resizing the row heights by mouse, you can cancel this action in the ResizingRows event.


private void gridDataBoundGrid1_ResizingRows(object sender, GridResizingRowsEventArgs e)
{
e.Cancel = true;
}

3) You can retrieve the cell state by using the following code.


private void gridDataBoundGrid1_CellMouseHover(object sender, GridCellMouseEventArgs e)
{
if(this.gridDataBoundGrid1.Selections.GetSelectedRows(true,false).Contains(GridRangeInfo.Row(e.RowIndex)))
textBox3.Text = "Cell is in current selection and mousehovered state";
else
textBox3.Text = "Cell is not in current selection and mousehovered state";
}


4) To find out the row that is being hit, please use the following code in CellClick event handler:


GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
this.textBox1.Text = this.gridDataBoundGrid1[cc.RowIndex,cc.ColIndex].CellType.ToString();
int row = this.gridDataBoundGrid1.CurrentCell.RowIndex;
this.textBox2.Text = row.ToString();


It is possible to mark the whole row as selected on clicking a cell in that row as well as turn on multiple row selection by setting ListBoxSelectionMode property to MultiExtended.

this.gridDataBoundGrid1.Model.Options.ListBoxSelectionMode = SelectionMode.MultiExtended;


Please refer the following sample that does the same.
http://websamples.syncfusion.com//samples/Grid.Windows/F77369/main.htm

Regards,
Rajadurai


Loader.
Live Chat Icon For mobile
Up arrow icon