Let's say that a user tabs from another control to my RadGridView and it receives focus. I want the grid to set the currently selected cell into edit mode. So I tried the following:
This works well, except when you try to tab off the last cell (row, column index). In that case, the grid receives focus for some reason and sets the last cell back into edit mode again. No matter how many times you try to tab off the last cell you cannot. This occurs when TabNavigation on the grid is set to Local.
In order to try and handle this issue I modified the GotFocus event like so:
Here I retrieve the GridViewCellInfo of the last cell. If the current cell is the last cell, I do nothing, ignoring the focus, and everything continues correctly. But if I cycle back through to the grid via tabbing later, and the grid receives focus, it won't put the last cell into edit mode, defeating the whole purpose in the process.
If you have any questions regarding what I've described please let me know. I can also supply a sample project if necessary.
Thanks.
void
RadGridView1_GotFocus(
object
sender, System.Windows.RoutedEventArgs e)
{
if
(
this
.RadGridView1.CurrentCell !=
null
)
{
if
(!RadGridView1.CurrentCell.IsInEditMode)
{
RadGridView1.BeginEdit();
}
}
}
This works well, except when you try to tab off the last cell (row, column index). In that case, the grid receives focus for some reason and sets the last cell back into edit mode again. No matter how many times you try to tab off the last cell you cannot. This occurs when TabNavigation on the grid is set to Local.
In order to try and handle this issue I modified the GotFocus event like so:
void
RadGridView1_GotFocus(
object
sender, System.Windows.RoutedEventArgs e)
{
if
(
this
.RadGridView1.CurrentCell !=
null
)
{
var info =
new
GridViewCellInfo(RadGridView1.Items[RadGridView1.Items.Count - 1], RadGridView1.Columns[RadGridView1.Columns.Count - 1]);
if
(RadGridView1.CurrentCellInfo!= info && !RadGridView1.CurrentCell.IsInEditMode)
{
RadGridView1.BeginEdit();
}
}
}
Here I retrieve the GridViewCellInfo of the last cell. If the current cell is the last cell, I do nothing, ignoring the focus, and everything continues correctly. But if I cycle back through to the grid via tabbing later, and the grid receives focus, it won't put the last cell into edit mode, defeating the whole purpose in the process.
If you have any questions regarding what I've described please let me know. I can also supply a sample project if necessary.
Thanks.