Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
875
Add New Record, how to get cursor to be in the add record row's first cell
posted

How can i get the cursor to be in the first cell of the row that is for adding a new record (the one with the + sign) after adding the record?  I also want it to be already in edit mode, so I should be able to use StartEditMode command after whatever gets me to the correct cell?  I have AddNewRecordLocation="OnBottomFixed" and AllowAddNew='"true".  Thanks!

 

So far,

private void dp_PreviewKeyDown(object sender, KeyEventArgs e)

{

if (e.Key == Key.Enter)

XamDataPresenter dp = sender as XamDataPresenter;

if (dp != null)

{

set active record/cell to the add row and enter edit mode here how?

}

}

Parents
No Data
Reply
  • 138253
    Offline posted

    Hello,

     

    It has been a while since you have made your post, in case you still need support I will be glad to assist you further. I suppose the other community members can benefit from this answer as well. I have been looking into your post and I suggest you use the following code in your XamDataGrid’s PreviewKeyDown event to achieve your goal:

     

    if (e.Key == Key.Enter)
    {
        Dispatcher.BeginInvoke(new Action(() =>
        {
            CellValuePresenter.FromCell(xamDataGrid1.RecordManager.CurrentAddRecord.Cells[0]).Editor.StartEditMode();
        }), DispatcherPriority.Background, null);
    }
    

     

    Feel free to write me if you have further questions.

Children
No Data