Hi,
I would like to add a new row in between extisting records using a context menu. Please provide some samples.
Thanks,
Ayyappan
Hello Ayyappan,
Thank you for your post. I have been looking into it and I created a sample project for you showing the functionality you want to achieve. Basically I create a ContextMenu for the XamDataGrid and handled its Item’s Click event and the XamDataGrid’s PreviewMoueseRightButtonDown events, in which I get the index if the clicked Record and insert a new one before it. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.
Thanks for your input. It works.
Regards,
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
I tried this example but it gives me this errorThe index must be within the limits of the list.Parameter name: index
Hello Mario,
Could you please tell me ,which is the exact version you are using and send me steps to reproduce, because I checked my sample again and it seems like everything works ok on my side.
use the version 11.2 and all developed in WPF I'll send you an example using entity framework here is an example of code Thanks for your help
ScadeXamDataGrid.DataSource = RetQuerryWPFSCANew()
Dim reca As Infragistics.Windows.DataPresenter.DataRecord = ScadeXamDataGrid.ActiveRecord Dim rins As Infragistics.Windows.DataPresenter.DataRecord = ScadeXamDataGrid.RecordManager.CurrentAddRecord
rins.Cells("codice").Value = reca.Cells("codice").Value rins.Cells("numdoc").Value = reca.Cells("numdoc").Value rins.Cells("datadoc").Value = reca.Cells("datadoc").Value rins.Cells("totdoc").Value = reca.Cells("totdoc").Value
ScadeXamDataGrid.DataItems.Insert(2, rins) ScadeXamDataGrid.RecordManager.CommitAddRecord()
I have been looking into your code and I can say that the XamDataGrid’s DataItems collection can be used if you want to add Items directly in the XamDataGrid and its DataSource shouldn’t been set to any object. In my sample I add the new Record in the underlying Data object and since the XamDataGrid is bound to it, changes reflects on the UI. Here you can read more about XamDataGrid’s DataItem Property:
http://help.infragistics.com/NetAdvantage/WPF/2011.2/CLR4.0/?page=InfragisticsWPF4.DataPresenter.v11.2~Infragistics.Windows.DataPresenter.DataPresenterBase~DataItems.html
Hope this helps you.