Is there a way I can disable the edit command button based on this property value of the current item in the collection. i.e. I want the edit command button to be enabled or disabled (based on this property) as I navigate through the collection.
I understand I can achieve the readonly mode by making the controls readonly in the EditTemplate based on this property. However, this would be tedious as there are too many controls in the form. Also, user clicking the edit button and not being able to edit (as the object is readonly) does not make a good user experience.
Just want to know if there is a simpler way other than changing the edit template.
Thanks and Regards,
Titus
7 Answers, 1 is accepted
You can try implementing this functionality in your ViewModel. For example:
1. Bind CurrentItem property of RadDataForm to a property in the ViewModel;
2. Once this property is changed, you can verify its property value (containing the information for read-only mode of the item) and based on it to disable/enable a custom command defined in this ViewModel.
3. Bind the Command of the Edit-Button to this custom command in your ViewModel.
Will that scenario correspond to your needs ?
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Yes it will.
I was looking to see if there is any way I can bind a property of RadDataForm to a boolean property on my Entity object to disable the edit button.
I wasn't looking to implement MVVM as the project I am working on is a prototype and was not planning to use View Models.
I guess I will use View Model.
Thanks
Titus
Can you provide and example of how to do step #3 above?
"3. Bind the Command of the Edit-Button to this custom command in your ViewModel."
I can make my own command in the view model, but how do I hook it up to the edit button?
You should modify RadDataForm's template, find the button and bind its Command and CommandParameter properties to the respective members of your ViewModel. Unfortunately, this is quite a unnatural approach, so we have planned to make this task achievable through the API with Q2.
All the best,Ivan Ivanov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
http://www.telerik.com/help/silverlight/raddataform-customize-commands.html
Thank you, Jen. Here is an additional running example.
All the best,Ivan Ivanov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.