Creating and implementing ValueConverters in your app
In this section, we will begin creating the ImageConverter
class for our TrackMyWalks
solution. ValueConverters
are an important concept in data binding, as they allow you to customize the appearance of a data property at the time it is bound. This process is quite similar to WindowsPresentationFoundation (WPF) on the Windows application development platform.
The Xamarin.Forms
platform provides you with a number of ValueConverter
interfaces as part of its API. These are extremely helpful as they allow you to toggle the visibility of elements based on a Boolean
property, or display an image based on a String
property.
Let's start creating the ImageConverter
class for our TrackMyWalks
app by performing the following the steps:
- Ensure that the
TrackMyWalks
solution is open in theVisual Studio for Mac IDE
. - Right-click on the
TrackMyWalks
shared project, chooseAdd | New Folder
from the pop-up menu, and enterValueConverters
for the name of the...