C# – WPF MVVM DataBinding 2014

It’s already 6 years since my first post about MVVM and data bindings in WPF MVVM – ListView SelectedItem and DataBinding. The MVVM pattern is now quite popular and comes into use in many WPF applications. However, a lot of things have changed since 2008. We have now many new platforms where we can also apply MVVM pattern such as the Windows 8 app, Windows phone app… When you use Xamarin (http://xamarin.com/) to develop cross platform applications with C#, maybe you want to use MVVM pattern too. In my last post 6 years ago, I introduced to you the concept of MVVM in ‘raw’ format which means no use of any external frameworks. Today I would like to make a supplementary post by introducing 2 MVVM frameworks for easing the use of the MVVM pattern. The first one is Caliburn.Micro https://github.com/Caliburn-Micro/Caliburn.Micro and the second one is Mvvm Cross https://github.com/MvvmCross/MvvmCross. They’re both open source products and can be used in any commercial applications.

Continue reading C# – WPF MVVM DataBinding 2014

MVVM – ListView SelectedItem and DataBinding

UPDATE: I recommend a new version of this post at following link C# – WPF MVVM DataBinding 2014

On studying how to use MVVM pattern in WPF I found out that the ListView or ListBox control doesn’t support ICommand interface and therefore I can not bind a command to a ListView. After searching on Internet I saw that man can use Prism extensions framework http://www.codeplex.com/CompositeWPF to add custom command to our ListView control. The example below guides step by step how to get SelectedItem of ListView in MVVM pattern using command.

Continue reading MVVM – ListView SelectedItem and DataBinding