I think that I smell a bug. Ok, kere is the scenario. Create a grid with three or more columns on it. Make the second column readonly. On the cellexitededitmode event check to see if you are exiting editing of the first cell. If so, activate editmode on the third cell. Begin typing in the third cell.
Meanwhile on the grid's keydown event, check grid.ActiveCell.Column.Key property and notice that is the second column.
wha? How can the second column be active and I am editing the third column and the second column is marked readonly?
Hello,
I have been looking through your issue and I went through your steps. I have created a grid with three columns and the second one is read only. I have added the KeyDown and the CellExitedEditMode events. Here what I have put in my CellExitedEditMode
if (e.Cell.Column.Key == "First") { xamGrid1.ActiveCell = xamGrid1.Rows[0].Cells[2];
Dispatcher.BeginInvoke(new Action(() => { xamGrid1.EnterEditMode(); })); }
And this is my key down event: private void xamGrid1_KeyDown(object sender, KeyEventArgs e) { string key = xamGrid1.ActiveCell.Column.Key; }
What is happening is that the grid acts as expected – if I steal the focus from the first column’s cell, by clicking on some other control for example, the active cell is the third one and it is in edit mode as well. However if we steal the focus by pressing tab, the third cells enters edit mode, but that does not mean that cells from the second read only column cannot be the active ones since the focus has been moved to them. The read only property prevents the cells from entering edit mode, not from being the active cells.
Please let me know if my answer meets your requirements or I have misunderstand you at some point.
Sincerely,
Ekaterina
Developer Support Engineer
Infragistics, Inc.
www.infragistics.com/support
This just seems totally illogical. The concept that I can be in edit mode in one cell but active in another one, maybe you can call it as expected, but it makes no sense to me.
Can you explain this syntax as well? You might have solved another issue I am having:
Dispatcher.BeginInvoke(new Action(() => { xamGrid1.EnterEditMode(); }));
What is Dispatcher.BeginInvoke all about?
Thank you for your answer.
I have managed to find a custom approach deals with your issue:
In ActiveCellChanged handler, check if the second cell is the active one and if it is so, activate the third one and put the grid in edit mode:
void xamGrid1_ActiveCellChanged(object sender, EventArgs e)
{
if (xamGrid1.ActiveCell.Column.DisplayNameResolved == "02")
xamGrid1.ActiveCell = xamGrid1.ActiveCell.Row.Cells["03"];
xamGrid1.EnterEditMode();
}
As to your question about the dispatcher’s - its function is to deal with the work items of a thread and I am using it to postpone the execution of the given Action. For more information please refer to the following link:
http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcher.aspx
If you require any further assistance please do not hesitate to ask.
I am checking if this is still an issue for you.
Infragistics
No, I don't think so. As a post mortum on this, I was not able to get this functionality to work without using the Dispatcher. It is almost as if the XamGrid depends on its behavior.
Hello Alan,
I am very glad that the custom approach with the dispatcher has manage to solve your issue. Please, in case of other concerns regarding this matter, do not hesitate to contact us.
Thank you for choosing Infragistics components.