We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to add new row in SFDatagrid ??

Thread ID:

Created:

Updated:

Platform:

Replies:

120968 Oct 29,2015 10:28 PM UTC Nov 2,2015 09:17 AM UTC WPF 3
loading
Tags: SfDataGrid
Luis Fernando
Asked On October 29, 2015 10:28 PM UTC

pressed as add new row , 
I want to completely add , 
without the need to switch to another row so
 that it can carry out the addition of the new row.??

OR

I do not want it then appears as if it had been added ,
I want to add a new row pressed as the new row is added and then appears the option to add another row

Ayyanar Sasi Kumar Jeyaraj [Syncfusion]
Replied On October 30, 2015 02:00 PM UTC

Hi Luis,

Thank you for contacting Syncfusion support.
We have analyzed your  query.
You can able to add the new row continuously without moving the Selection to another row by using the
CurrentCellActivated Event like below,
C#:
 

private void datagrid_CurrentCellActivated(object sender,

CurrentCellActivatedEventArgs args)

        {

            bool needToMove = (datagrid.IsAddNewIndex(args.PreviousRowColumnIndex.RowIndex)

                && !datagrid.IsAddNewIndex(args.CurrentRowColumnIndex.RowIndex)

                && (Keyboard.IsKeyDown(Key.Enter) || Keyboard.IsKeyDown(Key.Tab)));

            Dispatcher.BeginInvoke(new Action(() =>

            {

                var gridModel = this.datagrid.GetGridModel();

                var columnIndex = this.datagrid.GetFirstColumnIndex();

                if (needToMove && gridModel != null)

                {

                    this.datagrid.MoveCurrentCell(new RowColumnIndex(gridModel.AddNewRowController.GetAddNewRowIndex(), columnIndex));

                }

            }), DispatcherPriority.ApplicationIdle);
        }



In above code snippet, we have considered the Enter and Tab key to restrict the Selection to another row while adding new row. If you did a mouse interaction or arrow keys other than Enter and Tab key if the current Selection is in AddNewRowControl, you can able to switch another row  from AddNewRow position.

We have also prepared the sample for this requirement and you can download the sample from following location,

Sample:

http://www.syncfusion.com/downloads/support/forum/120968/ze/addnew_row344184716

Please let us know if you have any further assistance

Regards
Ayyanar

Luis Fernando
Replied On October 30, 2015 04:27 PM UTC

thanks for help

Ayyanar Sasi Kumar Jeyaraj [Syncfusion]
Replied On November 2, 2015 09:17 AM UTC

Hi Luis,

Thank you for the update .


Please let us know if you need further assistance on this.

 

Regards

Ayyanar



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;