I want to populate my ListPicker with the entries that I have in a database named FriendsClass.
My XAML:
<toolkit:ListPicker x:Name="friendPicker" SelectionMode="Multiple" Margin="129,283,10,119" BorderBrush="#FF8DCDC1" IsEnabled="False">
<toolkit:ListPicker.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}"/>
</DataTemplate>
</toolkit:ListPicker.ItemTemplate>
</toolkit:ListPicker>
My CS:
SplitDataContext db = new SplitDataContext("Data Source=isostore:/S.sdf");
List<FriendsClass> source = new List<FriendsClass>();
var friendQuery = from friend in db.Friends select friend;
foreach (var friend in friendQuery)
{
source.Add(new FriendsClass(){Name = friend.Name});
}
this.friendPicker.ItemsSource = source;
When I run my app, the ListPicker displays "Split.ViewModels.FriendsClass" instead of the name itself.
Here is my list of friends
But here is what appears on my ListPicker
What have I been missing? I've tried putting a ToList() function on my query but it's still the same. When I bind my ListPicker to my Friends table in the XAML, absolutely nothing appears.
Thank you very much for your help.
Figured it out: I used FullModeItemTemplate instead of the regular ItemTemplate in my xaml.
<toolkit:ListPicker x:Name="friendPicker" SelectionMode="Multiple" Margin="129,283,10,119" BorderBrush="#FF8DCDC1" IsEnabled="False" >
<toolkit:ListPicker.FullModeItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}"/>
</DataTemplate>
</toolkit:ListPicker.FullModeItemTemplate>
</toolkit:ListPicker>