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

Row selected handler

4 Answers 125 Views
GridView
This is a migrated thread and some comments may be shown as answers.
masha reznik
Top achievements
Rank 1
masha reznik asked on 19 Jan 2010, 10:32 PM
Hello,

I attached event handler for GridViewRow Selected event by eventSetter.
But i getting "Handler type is not valid" exception.


void Row_Selected(object sender, RoutedEventArgs e){} 
<Style TargetType="telerik:GridViewRow">  
     <EventSetter Event="Selected" Handler="Row_Selected"/>  
</Style> 
What should be the right handler type for this event?

Basicly what I'm trying to do is after the data is loaded to set programaticly the second colomn of Grid to current and in edit mode.
Additionaly on arrow navigartion Up/Down current cell should be updated to the up/down cell in the same colomn and always current cell should be in edit mode.

Thank you

4 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 20 Jan 2010, 12:25 PM
Hello masha reznik,

By default it is not possible to have a cell in edit mode and navigate with the keyboard arrow keys since the editor will steal all keyboard events. To be able to move the current cell you should first commit the edit by pressing the Enter key. Once the value is committed you will be able to navigate through the cells.

I have also implemented the functionality that you have requested in a sample project which is attached to this post. Hope it helps.

Regards,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
masha reznik
Top achievements
Rank 1
answered on 21 Jan 2010, 09:55 PM
Thank you Milan for your solution. But i have some strange behavior,
excuting after 

Grid.CommitEdit();
Grid.ItemsGenerator.ContainerFromIndex(rowIndex)
and 
Grid.ItemContainerGenerator.ContainerFromItem(item)
returns null for any index and item.

So thats leeds to exception on second excution of 

 

SetInEditMode

 

thanks

0
masha reznik
Top achievements
Rank 1
answered on 25 Jan 2010, 10:15 PM
I found out what was the cause of this behavior.
I had a SortDescriptor on another column, i found a work around for this, but  i think you have a bug.

thanks anyway
0
Milan
Telerik team
answered on 26 Jan 2010, 02:08 PM
Hello masha reznik,

Currently this is expected behavior since all items will be recreated when "Grid.CommitEdit();" is called. We are working on improving this behavior but for the time being you could just use a dispatcher to execute the code after CommitEdit.

Thank you for your feedback.


All the best,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
masha reznik
Top achievements
Rank 1
Answers by
Milan
Telerik team
masha reznik
Top achievements
Rank 1
Share this question
or