We have a situation where we need to set the CellClickAction at the cell level ( the setting depends on properties of the row), instead of at the column or override level. Is there an easy way to do this...or to achive the same functionality? We are currently on version 8.2.
Thanks,
Darin
Hello Darin,
I think that you can use the BeforeCellActivate event ot the UltraGrid to check the value of the current cell and decide what will be the activation for that cell. The code snippet should look something like that:
private void ultraGrid1_BeforeCellActivate(object sender, CancelableCellEventArgs e) { if (e.Cell.Value.ToString() == "Some String") { e.Cell.Activation = Activation.NoEdit.; }
}
Please let me know if this suits to your scenario.
Sincerely,
Danko Valkov
Developer Support Engineer
Infragistics, Inc.
It doesn't quite fit. We have different code to set the activation, but we need a way to tell the grid how to respond to the click. Our specific case when the cell activation is NoEdit we want the click action to be row select. When the row can be edited we want the click to put the cell into edit mode. If we do all the work to set the column's CellClickAction appropriatly it seems to behave the way we want it too, but it doesn't seem sustainable long term to micro manage the users interaction with the grid to that degree, but it would be really simple if we had a way to tell each cell how we would like it to respond to the click.
Thaks,
My situation was similar to the poster except that based on row type I wanted to select the cell when user tries to edit the cell. Answer above did not help - like many other answers on this forums :(
This is what I did that fits my need:
void ugrid_AfterEnterEditMode(object sender, EventArgs e)
{
if (uggrid.ActiveCell != null)
ugrid.ActiveCell.SelectAll();
Hi Darin,
What I would do is set the CellActivation to something that doesn't allow activation, like NoEdit or maybe ActivateOnly.
Then simply handle the MouseDown event of the grid and trap for when the user clicks on the cell and do whatever you want, such as selecting the row or calling PerformAction(EnterEditMode).
Here's how to tell what cell was clicked in the MouseDown.
HOWTO:UltraWinGrid Mouse Position and Cell Identification