I'm developing windows Phone 8 application.
In my app i use List Picker .list picker value is bind from web service (json format)
My web service result return format
[
- {
id: "9",
name: "Pizza",
root_id: "4",
level: "1"
},
-{
id: "10",
name: "Fine Dining",
root_id: "4",
level: "1"
},
]
My XAML code for list picker
<toolkit:ListPicker x:Name="filterpicker" SelectionChanged="filterpicker_SelectionChanged" Tap="filterpicker_Tap" Foreground="White" BorderThickness="0" Margin="395,-100,0,10" Height="70" Width="60">
<toolkit:ListPicker.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" Visibility="Collapsed"/>
</DataTemplate>
</toolkit:ListPicker.ItemTemplate>
<toolkit:ListPicker.FullModeItemTemplate>
<DataTemplate>
<TextBlock>
<Run Text="{Binding}"/>
</TextBlock>
</DataTemplate>
</toolkit:ListPicker.FullModeItemTemplate>
</toolkit:ListPicker>
My c# code for bind
void filterwc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
var filterdata = e.Result;
var filtervalue = JsonConvert.DeserializeObject<List<filterdatas>>(filterdata);
List<string> filtercategories = new List<string>();
foreach (filterdatas budval2 in filtervalue)
{
filtercategories.Add(budval2.id); /**I need to display the name and on selectionchanged event i need to get the id value**/
}
filterpicker.ItemsSource = filtercategories;
}
if my question is not clear plz tell i give more info ...
I need Like this
List picker out put come like this
Pizza
Fine Dining
On SelectionChanged Event
if i click Pizza I need to get "9"
if i click Fine Dining I need to get "10"
Thank you...