Newbie Question on Telerik and MVVM

2 posts, 0 answers
  1. Wayne Williams
    Wayne Williams avatar
    38 posts
    Member since:
    Jul 2019

    Posted 31 Jul 2019 Link to this post

    Hi,

    I'm new to Telerik. In learning MVVM, I've been religiously separating the ViewModel and Model. However, when looking at Telerik examples, such as those for RadDataForm, it appears that only one model class is used, and that it is bound directly to the View. The notes state that if I want to use change notification, I should implement INotifyPropertyChanged, which I typically do in the ViewModel. So, for best practice,should I split the sample class into a Model and ViewModel at this point?

    On a related note, I've been implementing IDataNotifyError in my test apps, but it appears that I can tap into Telerik's simplified validation model. So let me turn this this into a broader question. For a thorough understanding, I've been trying to reconcile Telerik's approach to the lessons/rules I've adopted from various WPF textbooks. Is this an easier way to do this, or should I abandon that goal and simply do things the Telerik way?

    Wayne

  2. Vladimir Stoyanov
    Admin
    Vladimir Stoyanov avatar
    673 posts

    Posted 05 Aug 2019 Link to this post

    Hello Wayne,

    It is good to hear that you are following the MVVM pattern. That said, note that not all of the available examples with the Telerik controls are set up according to it for simplicity's sake. With this in mind, it is up to you to decide how to setup up your data models and where to implement INotifyPropertyChanged depending on the exact scenario.

    As for the validation, the benefits of using the INotifyDataErrorInfo would be that if you visualize the data in another control(s) that respect(s) this interface (for example RadGridView), you won't have to duplicate code. 

    I hope you find this information helpful.

    Regards,
    Vladimir Stoyanov
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top