Hi,
We have a grid with a add button a the top (see image below).
A click on the add button display the "AddNewRow" at the bottom of the grid :
this.myGrid.AddNewRowSettings.AllowAddNewRow = AddNewRowLocation.Bottom;
But user had to click inside the new row to start editing.
Is there a way to put user directly in edit mode inside the add new row ?
Thanks for your help.
Alain.
Hello Cosoluce Stones,
I have been looking into your post and I can suggest using the following code in the body of the ‘Click’ event of the ‘Add’ button to put user directly in edit mode inside the add new row :
this. myGrid.AddNewRowSettings.AllowAddNewRow = AddNewRowLocation.Bottom;
Row rw = ((RowsManager)this. myGrid.Rows[0].Manager).AddNewRowBottom;
rw.Cells[0].IsActive = true;
myGrid.EnterEditMode();
If you have any other questions, feel free to ask.
Hi Yanko,
Thanks for this solution.
But my problem it that it only works when there is rows in the grid (...this. myGrid.Rows[0]....).
Do you have a solution when there is no rows ?
Thanks.
No, it's not an issue. The sample works fine, thanks!
Regards.
Hello,
Thank you for your feedback. I am very glad that you have solved your issue.
Hey Yanko,
I am trying something similar in my VB application, but I am getting an exception when I try either of these calls. One difference is that I am not using the Dispatcher.BeginInvoke syntax. Is that what could be causing the exception?
e.Cell.IsActive = True Me.dgDataEntry.EnterEditMode(c)
The exception reads somethink like :
Error HRESULT E_FAIL has been returned from a call to a COM component.
Aha. There must be something going on with that. If I comment out your Dispatcher code, your sample throws the same exception. Now, if I could only figure out the VB equivalent syntax...
I fixed my problem, but since I am using VB, I had to take a different approach with the Dispatcher.BeginInvoke syntax
Dispatcher.BeginInvoke(AddressOf BeginEditModeOnNewRow)
Private Sub BeginEditModeOnNewRow()
Dim c As Cell = Nothing Dim d As XamGrid = Me.dgDataEntry
c = d.Rows(d.Rows.Count - 1).Cells(0) c.IsActive = True d.EnterEditMode(c)
End Sub
Hello Alan,
Thank you for you feedback. I am glad that you have solved your issue.
If you need any further assitance on this matter, feel free to aks.