I would be very interested in seeing that sample wherein this works if you have one.
The scenario i'm using is quite complicated and it has a lot of code. It also uses MVVM.
I did the following:
I have create a custom dataform component "ExqiDataForm" that inherits from RadDataForm. The reason why i did that is so that i could override the control template for all of the RadDataForms of that type. In the control template i added a third button "Save".
I have created a RadWindow for editing the details of an Entity called "OrganizationUser". On that window i have placed a ExqiDataForm with two templates... one for Adding and one for Editing an OrganizationUser. The dataform is bound to a DomainDataSource.
When the user clicks on the Add button in the main application, it will instantiate the RadWindow containing the ExqiDataForm and it will execute following code on the ExqiDataForm:
This will effectievely make the OrganizationUserEditor display the AddNew template.
When the user clicks on the SAVE button on the ExqiDataForm, it will execute an MVVM command that will execute a SubmitChanges() on the RadDomainDataSource. I have also hooked the SubmittedChanges event on the DomainDataSource bound to the dataform. So when SubmitChanges is executed in MVVM, the SubmittedChanges event is fired right after. In this event, i reload the DomainDataSource like this:
QueryParameter qp = new QueryParameter();
qp.Value = (e.ChangeSet.AddedEntities as OrganizationUser).OrganizationUserId;
qp.ParameterName = "organizationUserId";
organizationUserDomainDataSource.QueryParameters = qp;
This is necessary, otherwise the DomainDataSource will not contain the database record that we will edit straight after. It is here that it goes wrong... i would expect the DataForm to be in edit mode right after this load() command, but it is not.
What am i doing wrong?