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

XAML Tuple binding?

$
0
0

Are XAML string bindings through Tuples supposed to work?

My ViewModel:

public (string Value, string Unit) MyTuple => ("-", "ft")

// HACK: Workaround
public string MyTupleValue => MyTuple.Value;
public string MyTupleUnit => MyTuple.Unit;

I'd like to do the following:

<Label Text="{Binding MyTuple.Value}">
<Label Text="{Binding MyTuple.Unit}">

However, it doesn't result in anything being displayed (although MyTuple gets called for both Labels).

My workaround:

<Label Text="{Binding MyTupleValue}">
<Label Text="{Binding MyTupleUnit}">

I've also tried removing the C#7 component names Value and Unit and using Item1 and Item2 instead, but that also didn't work.


Viewing all articles
Browse latest Browse all 77050

Trending Articles



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