I have an array of strings, that I have set as the item source of a ListView. The ListView now has the same amount of rows as the array has elements. However I don't know what to set the binding as. I know for a Dictionary I set 'Value' which works fine.
string[] array = {"1","2","3"};
MyListView.ItemsSource = array;
XAML
<ListView x:Name="MyListView">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Label Text="{Binding Value, StringFormat='The value : {0:N}'}" />
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
If you want to bind directly to the value of the object itself, use the "." syntax for the path
<Label Text="{Binding .}" />
To bind directly to the object you should use:
<Label Text="{Binding}" />
This is shorthand for:
<Label Text="{Binding Path=.}" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With