This is a migrated thread and some comments may be shown as answers.

How to new line cell focus

1 Answer 115 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
athasian asked on 08 Apr 2010, 03:49 AM

I have an question about the focus of Cell.
Immediately after adding a new line, It does not work, although he would like to move the focus of Cell to the specified column of added line.
For example, item will be null in The following codes.

(at Button1_Click method)
radGridView.SelectedItem = radGridView.Items[insertingRowIndex];
radGridView.CurrentItem = radGridView.Items[insertingRowIndex];

var m_ColumnIndex =1;
var item = (GridViewRow)radGridView.ItemContainerGenerator.ContainerFromIndex(insertRowIndex);
// item is null
// NullReferenceException

Telerik RadControls for WPF 2010 Q1 309 Trial
Visual Studio:2010 RC

Please help me.


1 Answer, 1 is accepted

Sort by
Nedyalko Nikolov
Telerik team
answered on 13 Apr 2010, 02:45 PM
Hello athasian,

Indeed GetContainerFromIndex() method may return null in some cases.
My guess is that you do not want just to set focus of the cell, but also you want to put it in edit mode.
I'm attaching sample project that demonstrates how to do this. After starting of the application click somewhere in the grid and press Insert key. Let me know if this doesn't help, but I will need some more detailed information about your scenario (type of the data source and type of the business object and all information that you can find useful).

Sincerely yours,
Nedyalko Nikolov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Asked by
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Share this question