Using value converters

Often when we consume data from the network or a local database, the values we retrieve aren't always in the appropriate format for user presentation, such as dates as we demonstrate in this recipe example. You have a property type of DateTime, and you want to display it to the user's screen in a detailed form such as MM/dd/yyyy HH:mm:ss.fff.

To achieve this in the following recipe, we are using a value converter.

How to do it…

  1. Create a Visual Studio Blank App (Xamarin.Forms Portable) solution named XamFormsValueConverter, from the top menu File | New | Project….
  2. Right-click the XamFormsValueConverter portable class library and choose Add | Class…; name it NotifyPropertyChangedExtension.cs and click Add.
  3. Make the newly created ...

Get Xamarin: Cross-Platform Mobile Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.