All tagged xamarin forms mvvm

Xamarin Forms MVVM - IValueConverter

In the previous posts, I have been creating a "calculator" using the MVVM architectural pattern, explaining the ICommand and INotifyPropertyChanged interfaces. I suggest you fork the code from this repository and take a look at the branches so you know what we added in each of those posts, or better yet, read through those posts before continuing with this one.

Because in this post we will take a look at the IValueConverter interface, and how it is a key interface that you can use when you have some information on the Model that has to be presented differently in the View. Say a DateTime that instead of displaying "2018-03-21T15:04:30.0000000-06:00" has to be displayed as "two days ago".

I will implement a very easy example that I hope will make it clear how you can use the interface.

Xamarin Forms MVVM - ICommand

In the previous post, we talked about the INotifyPropertyChanged, and I gave a small introduction about the MVVM architectural pattern, and how it will allow you to structure your code in a way that will make it easy to maintain, easy to scale and easy to reuse.

This post will be about the ICommand interface. If you have created Xamarin Forms applications before, this interface will help you replace all the event handlers you have in the code behind for button clicks (and other events) for code that you can now move over to your ViewModel.