Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Xamarin Forms Listview XAML- How to add a binding to a function ?

$
0
0

Hey guys ,

I have a model that contains a birthday(1993-01-03) and gender (M , F)

public string bday { get; set; }
public string gender { get; set; }

I can use them in a listview xaml binding like this :

Text="{Binding gender}"

However , i need to process the model data before displaying it . Basically , i want a string that says "20M"

So i created a function in the model

public string getCustomString()
    {
        // do something 

    return "20M";
    }

But how do i call it in the xaml binding ?

Text="{Binding getCustomString()}"

Any ideas ?


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>