CslaDataprovider in MVVM

CslaDataprovider in MVVM

Old forum URL: forums.lhotka.net/forums/t/9747.aspx


hanspret posted on Thursday, November 11, 2010

Hi

I am using the MVVM design pattern in Silverlight. I got a datagrid that display Users with one column displaying roles as a combobox. The user of the application can link a Role to a User by selecting a role from the combobox inside the datagrid.

The datagrid is basically bound to the ViewModel, but my combobox is bound to a CslaDataProvider. The add new and Save works as expected but the cancel is not working to expectation. For instance when I edit an existing user and select a different role and then click the cancel button the cancel doesn't happen.

Is this beacause of the CslaProvider or is the cancel function not working correctly with datagrids in Silverlight?

Has anyone else had problems with cancel using Datagrids in Silverlight using MVVM?

RockfordLhotka replied on Thursday, November 11, 2010

The data provider model isn't a particularly great tool for implementing MVVM. In fact, since Microsoft has pretty much stopped focusing on the data provider concept, I view it as a legacy technology and only left it in CSLA 4 for backward compatibility.

I suggest using the ViewModelBase or ViewModel classes. They are designed to support MVVM as discussed in the CSLA 4 MVVM video series, and are generally easier and more powerful than the data provider model.

Copyright (c) Marimer LLC