views:

148

answers:

1

In MVVM, The ViewModel is a model for the view. And the real power comes in when we bind ViewModel to View in WPF.

However, if third party control does not support data-binding (not supporting all functionality), in that case is it worthwhile to use MVVM?

+4  A: 

I think it's more worthwhile not using that third party control set, because data binding is so intrinsic and important in the WPF world.

That said, if you must use the third party controls in question, you can still get value from MVVM. Your code will still be more testable, for one. Designers can take ownership of the XAML, for two.

Note that you can normally write attached behaviors such that you can still use data binding when a third party control doesn't play nice with WPF. For example, suppose a third party grid requires you to manually populate its items. In that case, you can encapsulate that population logic into an attached behavior that monitors a source collection and automatically updates the grid when the collection changes:

<thirdparty:Grid behaviors:GridBehaviors.ItemsSource="{Binding SomeCollectionOnYourViewModel}"/>

HTH, Kent

Kent Boogaart