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

[Solved] Keyboard downkey

1 Answer 115 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Keshava
Top achievements
Rank 1
Keshava asked on 20 Jan 2011, 06:11 AM
Hi,
    I am using radDatadomain source to bind the values to grid..
  when i go to the last row and press the down arrow key i want a new row to be added ..
how can it be done?
I am using silverligth 4 and using a telerik grid

1 Answer, 1 is accepted

Sort by
0
Accepted
Maya
Telerik team
answered on 20 Jan 2011, 08:26 AM
Hello Keshava,

You may subscribe to the KeyDown event of the RadGridView and handle it as follows:

public MainPage()
        {
            InitializeComponent();
            this.playersGrid.AddHandler(RadGridView.KeyDownEvent, new KeyEventHandler(OnKeyDown), true);
        }
 
        private void OnKeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Down)
            {
                var grid = sender as RadGridView;
                Player currentItem = grid.SelectedItem as Player;
                if (currentItem != null && grid.Items.IndexOf(currentItem) == grid.Items.Count-1 && grid.CurrentColumn.DisplayIndex == grid.Columns.Count-1)
                {
                    grid.BeginInsert();
                    grid.CurrentColumn = grid.Columns[0];
                }              
            }
        }

 

Regards,
Maya
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Tags
GridView
Asked by
Keshava
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or