Hi,
I am using xamdatagrid and have two issues associated with it.
1. After entering a value in the AddNewRecord row, and clicking anywhere outside the row on the XamDataGrid seems to add the row to the collection.How do I prevent adding a new row to the collection if the record is not become dirty yet.
2. How to prevent gray out in the check box inside AddNewRecord row. Instead grey , would like to show the checkboxes unchecked.
Kind regards,Suresh
Hello Suresh,
I have modified the sample I sent you before, so now it follows your scenario and everything seems to work ok on my side. If the sample doesn’t satisfies all your needs feel free to modify it, so it reproduces your behavior and send it back to me for further investigation.
Looking forward for your reply.
Hi Stefan,
Model has string property called PrimaryFlag , CurrentFlag. I am showing them as checkbox in XAmdatagrid. LoadEmail() is used to populate the data into xmadatagrid. that's why i am doing this conversion in this method..
public void LoadEmails() { InmateEmailPayload payload = InmateDataProvider.RetrieveEmailsByKey(InmateFolder.BookingKey); this.Emails = new NestedObservableCollection<DtoEmailAddress, EmailViewModel>(this, payload.InmateEmails.ToList<DtoEmailAddress>());
foreach (var item2 in payload.InmateEmails) { if (item2.PrimaryFlg == "Y") { var itemPrimary = Emails.Where(m => m.EmailAddress == item2.EmailAddress1).ToList().First(); itemPrimary.IsPrimary = true; itemPrimary.IsPrimary1 = true; itemPrimary.HasChanges = false; } if (item2.CurrentFlag == "Y") { var itemCurrent = Emails.Where(m => m.EmailAddress == item2.EmailAddress1).ToList().First(); itemCurrent.IsCurrent = true; itemCurrent.HasChanges = false; } } this.Emails.CollectionChanged += Emails_CollectionChanged; }
private bool _IsCurrent; public bool IsCurrent { get { Model.CurrentFlag = (_IsCurrent) ? "Y" : "N"; return _IsCurrent; } set { _IsCurrent = value; OnPropertyChanged("IsCurrent", true); } }
private bool _IsPrimary; public bool IsPrimary { get { Model.PrimaryFlg = (_IsPrimary) ? "Y" : "N";
if (_IsPrimary) { IsPrimary1 = true; } else { IsPrimary1 = false; } return _IsPrimary; } set { _IsPrimary = value; OnPropertyChanged("IsPrimary", true); } }
Kind regards,
Suresh
I don't know how to cut it short and send it. Can you met me know what i have missed in the email so that i could send those in text attachment.
I have been looking into the code you have shared, but it seems like that I am missing something about your scenario, so could you please send us a sample project, where your issue is reproduced, so we could be able to investigate this further for you.
Just noticed that you have fixed check box gray. It works for me when i loaded the grid for first time. But when i hit refresh , again the new record check box becomes gray. I have attached the code snippet.
I have tried enough to make new record check box gray when it is loaded. You made this easy now.. thanks for helping me to make new record check box grey when grid gets loaded at first...
But you find my fault on doing refresh action, would be great and helpful.
Awesome :)
suresh