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
3160
How to set active row to newly added record and put row in edit mode
posted

I've reviewed several posts in searching for an answer for this, notably these two:

http://forums.infragistics.com/forums/t/51615.aspx
http://community.infragistics.com/forums/t/53085.aspx

What I want to accomplish is this:

1.) When the grid receives the focus I want the row selector to move to the "new record" row

2.) I want the row to be in edit mode.  In my case the control in the first column is a XamComboEditor.  I want the cursor to be placed in the textbox without the user needing to click on the cell.

3.) When the user tabs past the last column and the row is updated I want the active row to stay on the new record row ( 1.) and 2.) happen again). 

The project attached to the second link above demonstrates some of the functionality I request.  I am using a XamCombobox in the first column of my grid however and I cannot figure out a way to put it in edit mode (the user aways has to click).

 

Thanks for the help!

Sam

  • 3160
    posted

    My bad, the answer is (mostly) found here: http://forums.infragistics.com/forums/t/51615.aspx

    For the benefit of anyone else trying to do this, here is what works (thus far) for me:

    public Record NewCashParameterRecord;

            private void CashParameterGrid_RecordUpdated(object sender, Infragistics.Windows.DataPresenter.Events.RecordUpdatedEventArgs e)
            {
                if (e.Record == NewCashParameterRecord)
                {
                    Infragistics.Windows.DataPresenter.XamDataGrid dp = sender as Infragistics.Windows.DataPresenter.XamDataGrid;
                    Dispatcher.BeginInvoke(new Action(() =>
                    {

                        dp.ActiveRecord.RecordManager.CurrentAddRecord.Cells[0].IsActive = true;

                        dp.ExecuteCommand(DataPresenterCommands.StartEditMode);

                    }), System.Windows.Threading.DispatcherPriority.Background, null);
                   
                    NewCashParameterRecord = null;
                }
            }

            private void CashParameterGrid_RecordAdded(object sender, Infragistics.Windows.DataPresenter.Events.RecordAddedEventArgs e)
            {
                NewCashParameterRecord = e.Record;
            }