DataForm Binding MVVM

2 posts, 0 answers
  1. fenix2222
    fenix2222 avatar
    13 posts
    Member since:
    Sep 2008

    Posted 06 Jun 2016 Link to this post

    How can I bind DataForm? I have a button which is outside of the form and I am binding everything to a ViewModel. How do I use form in MVVM fasion? All available methods like ValidateAll, CommitAll etc. are not useful and there is no IsValid property to bind to so taht I know when form is valid? How do I do it? Do I somehow glue it with FormValidationFinished event?
  2. Rosy Topchiyska
    Rosy Topchiyska avatar
    586 posts

    Posted 08 Jun 2016 Link to this post

    Hi Igor,

    Thank you for contacting us.

    What I understand is that you don't know when the form is valid, so that you could commit your changes. This could vary depending on the validation and commit mode, and you have to be more specific about the scenario you wish to accomplish.

    The form does not have IsValid property because on Android validation and committing are asynchronous. This is why we have events that are fired when the asynchronous operations are completed. Depending on the validation mode, you could use two types of events:
    • Immediate/OnLostFocus validation: PropertyValidationCompleted event, which is fired after change in a property editor.
    • Manual validation: FormValidationCompleted event which is fired after ValidateAll() method is called.

    I have prepared a sample project that demonstrates how to use a RadDataForm control in a MVVM scenario with immediate validation and commit modes. You can take a look and see if this could help.

    Please, let us know if you have further questions.

    Rosy Topchiyska
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top