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

How to create complex bindings?

$
0
0

I'm setting up DataTemplate for ListView. It's easy to create a binding for a single property. For example:

listView.ItemTemplate = new DataTemplate(() =>
{
    var cell = new TextCell();
    cell.SetBinding<MyModel>(TextCell.TextProperty, m => m.Name);
    return cell;
});

But how to create a complex binding? For example:

cell.SetBinding<MyModel>(TextCell.TextProperty, m => string.Format("{0}: {1}", m.Name, m.Description));

(if you do so, ArgumentException is thrown)


Viewing all articles
Browse latest Browse all 77050

Trending Articles



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