Hi,
how can I create a field with following behavior:
1. When record added, primary key field (or any specific field) can be modified like any other field in the record
2. After I am done with editing a new record (either hit Enter or unfocus record), the field becomes read-only (and all other fields in the record are editable as usual)
Thanks.
Hello Ilya,
Thank you for your post. I have been looking into it and I can suggest you handle the XamDataGrid’s EditModeStarting event and use the following code in the handler:
if (e.Cell.Field.Name == "Index" && e.Cell.Record.IsDataRecord) { e.Cancel = true; }
This way the editing is canceled for the Field called Index if the cell is part of a DataRecord. If it is in the AddNewRecord it is editable. Please let me know if this helps you or you have further questions on this matter.
Looking forward for your reply.
Hi Stefan,
it worked, but I also had to add a check for a Record.IsAdded property, otherwise the cell would become read-only right after it gets unfocused.
Thanks for the idea.
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.