Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Xamarin.Forms

You're reading from   Mastering Xamarin.Forms Build rich, maintainable, multi-platform, native mobile apps with Xamarin.Forms

Arrow left icon
Product type Paperback
Published in Mar 2018
Publisher
ISBN-13 9781788290265
Length 192 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Ed Snider Ed Snider
Author Profile Icon Ed Snider
Ed Snider
Roberto Hernandez Roberto Hernandez
Author Profile Icon Roberto Hernandez
Roberto Hernandez
Arrow right icon
View More author details
Toc

Value converters

Value converters form an important concept in data binding because they allow you to customize the appearance of a data property at the time of binding. If you have done any WPF or Windows app development, you will probably be familiar with how value converters work. Xamarin.Forms provides an almost identical value converter interface as part of its API.

One of the biggest benefits of a value converter is that it prevents you from having to add a bunch of getter properties to your data model to adjust how things are displayed. For example, imagine you have a status property on your model, and you want to change the font color of the status when it is displayed based on its value. You could add a getter property to your model that returns a color based on the current value of the status property. This approach works, but it clutters the model and also potentially...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime