How to move gridview selected row up/down on KeyUp or Keydown press

2 posts, 1 answers
  1. ajoua taha
    ajoua taha avatar
    25 posts
    Member since:
    Feb 2016

    Posted 07 Mar 2016 Link to this post

    So as the title states, I'm trying to navigate between rows in a GridView when a cell* ( * : cell correspond to third row and quantity column in my case )  is editing by clicking up/down , so when i navigate up/down , the new selected row also have cell* editing   , here is my gridview

    <telerik:RadGridView Grid.Row="2" Grid.ColumnSpan="3"
             ItemsSource="{Binding CurrentDetailBLLs}"
             SelectedItem="{Binding SelectedCurrentDetailBLL,Mode=TwoWay}"                  
             IsSynchronizedWithCurrentItem="True" KeyUp="dataGridView1_KeyUp">
                                DataMemberBinding="{Binding Path=ProductID}"
                                Header="ProductCode" />
                                DataMemberBinding="{Binding Path=ProductName}"
                                Header="ProductName" IsReadOnly="True">
                                DataMemberBinding="{Binding Path=Quantity}"

    the attached image make clear what i am talking about .

    help plz !

  2. Answer
    Stefan Nenchev
    Stefan Nenchev avatar
    665 posts

    Posted 08 Mar 2016 Link to this post

    Hi Taha,

    Thank you for the image and the code provided.

    As the default TextBox handles the KeyDown and KeyUp events, it is not possible to use a Custom Keyboard Command Provider, which usually is the way to go in such scenarios. What you need to do is handle the PreviewKeyDown event of the RadGridView and perform the logic for pressing the Up and Down keys inside.

    I have created a sample project that implements the desired behavior. Please, review it and update me if such approach would be useful. 

    I will be looking forward to your reply.

    Stefan Nenchev
    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 Feedback Portal and vote to affect the priority of the items
Back to Top