Ok, I took some hours to see what other options I had and I can tell you that none of the possibilities you talked about can be used...
I understand the arguments that the DataForm should do its own housekeeping...
Just, I need that the grid gives me the possibility to do it...
Let me explain again what I have. I have a radgridview listing some customers. In the (external) detail row I have a dataform that let's me add/edit/mod the customer's address.
The scenario is that I select a customer's row. His address related property is databound to the dataform currentitem.
I modify the address for example I set azerty as a zip code. I try to submit changes using a save button foudn outside the grid. The dataform validation fails and the data are not submitted. That all is correct.
Now, with the dataform still displaying the errors I click on another row in the grid... Here the dataform fires an exception because I try to change the current item (because the databinding link) wheras the current item still has validation errors...
None of the dataform events are of any help... They have all already played their role or come too late or not at the good moment.
private void addressForm_ValidatingItem(object sender, System.ComponentModel.CancelEventArgs e)
has already fired and has throw a validation exception. the validation errors are still present.
private void addressForm_EditEnded(object sender, DataFormEditEndedEventArgs e)
private void addressForm_EditEnding(object sender, DataFormEditEndingEventArgs e)
did not fire because edit has not ended
private void addressForm_LostFocus(object sender, RoutedEventArgs e)
we lost the focus earlier at validation
private void addressForm_CurrentItemChanged(object sender, EventArgs e)
comes too late after the exception I get.
Even if I had a CurrentItemChanging event I would not be able to ask the grid not to change row in case the dataform is not valid.
You are right by telling that SelectionChanged comes too late but I'm pretty sure now that my solution would be to have a SelectionChanging event that would allow me to cancel the row selection change before it happens.
If I had that event I could either check if that dataform.IsValid and if it not the case I would e.Cancel = true;
Also, I could eventually clear the dataform validation errors if I wanted because in that case the dataform doens't mind to move to another currentitem (note that I did not bind a list of addresses but only one address to the currentitem)
So, clearly, I think that it is the grid's role to let me cancel a row selection change, not the dataform's role to move back to its parent.
The RowDetailsVisibilityChanged event comes too late too or too soon depending if I'm leaving or coming to the row...
As for accessing the row details, I would like to do it from outside the grid... This would let me check the dataform validity or eventually endEdit or clean up things directly from my page's save button...
also that would let me bind the IsEnabled of the grid to the HasValidationErrors of the dataform as this seems to be my only option left... that way I cold disable the grid as long as no movement is possible...
What do you think of that... can I have my SelectionChanging event now mister telerik? Please?