Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Xamarin Picker get value

$
0
0

A class
public class A
{
public int id{get;set;}
public string name {get;set;}
}

XAML

   <Picker x:name="picker1" ItemsDisplayBinding = "{Binding name}" ItemsSource="{Binding SomeClass}" SelectedIndexedChanged="fun"/>

    <Picker x:name="picker2" ItemsDisplayBinding = "{Binding some_val}" ItemsSource="{Binding A}"

XAML.cs
fun()
{
var value = picker1.Items[picker1.SelectedIndex];
}

In Picker 1 if I set ItemsDisplayBinding = {Binding name}, then the value in the picker contains "NAMES"
In Picker 1 if I set ItemsDisplayBinding = {Binding id}, then the value in the picker contains "ID"

The issue is I want to DISPLAY "names" in picker1 but want the value of the corrosponding "ID". How is this possible?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



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