We are evaluating RadDataForm (2012.1) using an MVVM approach. The DataForm is bound to a QueryableDomainServiceCollectionView (QDSCV) on the ViewModel, Navigation/New/Edit/Delete buttons are visible, OK/Cancel buttons are hidden. When clicking on the Edit-Button the RadDataForm goes into Edit-Mode - so far, so fine. We now have a separate button outside the DataForm which when clicked does a QDSCV.CancelEdit(). Even though the QDSCV has no more CurrentEditItem still the RadDataForm is displaying data in Edit-Mode. How can we force RadDataForm to cancel edit? Remember we are using the MVVM pattern so we don't want to use methods on the control directly.
Regards
Neils
5 Answers, 1 is accepted
You can try using CancelEdit command placed in RadDataFormCommands class.
Maya
the Telerik team
Regards
Neils
Indeed, you can use only a single command for a button. Could you clarify what is the current implementation of your command ?
Generally, you can create a custom command in your ViewModel and perform all the actions you want in its Execute method. Thus you could be able to use your own custom logic as well as implementing the CancelEdit command of the data form.
Maya
the Telerik team
Best regards
Neils
Indeed, you are correct, I misled you in suggesting to work with the CancelEdit command of the data form as you will need a reference to it. What you can try instead is to create custom UserControl, place the button inside and perform the logic for canceling editing of the data form and the source collection inside.
Nevertheless, we will definitely consider improving the behavior and research the possibility for exposing the commands of the data form.
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>