Hello again,
In my application, I need to validate the row before it's added to the grid and cancel the operation if the row is erroneous. I'm using a simple method:
xamGrid.RowExitingEditMode += (s, e) => { var data = e.Row.Data as AddressBookRecord; if (!e.EditingCanceled && !data.IsOkay()) e.Cancel = true; };
However, sometimes this handler runs before the setter of the field is invoked, thus making the data invalid.
When I try to debug, I see the following line in the output:
System.Windows.Data Error: 40 : BindingExpression path error: 'RowData' property not found on 'object' ''AddressBookRecord' (HashCode=18474007)'. BindingExpression:Path=RowData; DataItem='AddressBookRecord' (HashCode=18474007); target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')
I have attached the project where the issue occurs. The steps to reproduce the error are:
1. Click the "Add Contact" button.2. Type a random name, press tab, type a random email, press Enter and see the row created.3. The Output window of Visual Studio will show both setters fire and data being valid.4. Repeat the first two steps once again and see the error and the second setter not firing.
HI Antonk,
I was not able to track yourerror down.
I created a more simpler version of your program.
I have a button that shows the AddNewRow and I bind the XamGrid to a ListCollectionView and once the row is added the AddNewRow disappears. Please review my sample..Sincerely, Matt Developer Support Engineer
Hello Matt,
I have removed all the extra code from my solution except for the one needed to reproduce the error. It's apparently being caused by the combination of the following tricks I try to do:
1. Make the Add New Record row hide and show.2. Programmatically activate the editors in the Add New Record row.
I have attached the resulting solution.
To reproduce the bug:
1. Click "Add contact" to activate the editor.2. Fill in the fields3. Try to add two records and see it fail on the second one because Email setter does not fire
4. Modify the source code: comment the hideNewRow method body and set xamGrid's AllowAddNewRow property to Top.
5. Try adding some records now - it should work fine.
I will be looking forward to your reply.
HI AntonK,
I am reviewing your new sample and steps.
Sincerely, Matt Developer Support Engineer
Hi,
Your issue has been resolved by the latest serivce release.
Please let me know if you need further assistance regarding this issue.
I will look into this issue for you.
I sent you an email thru our case management system to discuss your unique situation.
Hello, Matt,
It's been a month since you have acknowledged the bug. Are there any expectations on when it is resolved?
Yes, I reproduced this issue and submitted a developer issue for it.
Did you manage to succeed in reproducing the issue?