Hi,
I am new to xamDataGrid and I have question on how to archieve paste multiple rows when I select the last row in the data grid.
I always get a message "The area taht you are trying to paste the clipboard infomration does not have enough rows. Continue will copy as much in information as can fit in the cells available but will result in loss of data. Continue with operation?"
If I press ok, only the first row will be pasted.
What I want is that all other rows can be created as new, is this possible?
Thank you!
Hello,
Glad to hear, this worked for you. Please let us know if you need any further assistance on the matter.
If this is what you were looking for please verify the answer so it helps other users as well.
In order to add new records in the grid using the paste operation you need to use the Add New Row.
If you have 10 records (i.e.) select 2 of them then press copy. After that you select the 3-rd record the grid will try to replace the 3 and 4 with the values of the 2 selected records. So when you copy 5 records and then you select the last one the grid is trying to find place for 5 records and that is why you get the message. However if you need to add them you will have to paste them inside the Add New.
Thanks,
Slavi
Thanks for the quick reply.
Here is my code snippets:
<ig:XamDataGrid x:Name="igGrid" Grid.Row="2" Height="400" > <!-- Disable XamDataGrid fields automatic generation. --> <ig:XamDataGrid.FieldLayoutSettings> <!-- If you prefer to design your own fields' layout, set AutoGenerateFields property to 'False' and create Fields collection --> <ig:FieldLayoutSettings AutoGenerateFields="False" SelectionTypeCell="Default" SelectionTypeField="Single" SelectionTypeRecord="Extended" AllowAddNew="True" AddNewRecordLocation="OnBottomFixed" AllowClipboardOperations="All" CopyFieldLabelsToClipboard="True"/> </ig:XamDataGrid.FieldLayoutSettings> <ig:XamDataGrid.FieldLayouts > <ig:FieldLayout IsDefault="True" > <ig:Field Name="SKU"/> <ig:Field Name="Name" /> <ig:Field Name="Category" /> <ig:Field Name="Supplier" /> </ig:FieldLayout> </ig:XamDataGrid.FieldLayouts> <!-- Enable field selection and disable cell editing--> <ig:XamDataGrid.FieldSettings> <ig:FieldSettings LabelClickAction="SelectField" AllowEdit="True"/> </ig:XamDataGrid.FieldSettings> </ig:XamDataGrid>
The put the "new row" at the bottom.
Only when I select the "new row", paste multiple rows works.
However if I select last row (not the "new row"), the messagebox will still display
Hi Ima,
In order to paste the selected record (s) you need to select the add new row and then press paste. To enable the add new row set: XDP.FieldLayoutSettings.AllowAddNew to true.
If for some reason you don’t wish to show the Add new row all the time you can hook to the copy command and enable the add new only then and after paste was execute to hide it.