Reputation: 685
I am using a toolkit:Listpicker for wp8 with data binding. there is a textbox in the datatemplate of listpicker which is taken from an element of List projectList.
I have done the binding in the code this ways :
List<Project> lists= new List<Project>();
listPickerOptions.ItemSource = lists;
The textbox is binded to the data, but since the data is more than 5, when i select the data it takes me to a new screen where each element is shown as namespace.Project
I am new to databinding.
Following is the .xaml part for listpicker
<StackPanel Orientation="Vertical" Height="167" Margin="0">
<TextBlock Text="Domain" Margin="13,0,285,0" x:Name="Domain"/>
<TextBox IsEnabled="False" Text="Redmond" x:Name="Domain_txtBox" Visibility="Collapsed"/>
<toolkit:ListPicker x:Name="listPickerDomainOption" ItemsSource="{Binding Title, ElementName=this}" HorizontalAlignment="Right" Height="123" Margin="0,0,11,-30" VerticalAlignment="Top" Width="442" ExpansionMode="ExpansionAllowed" Visibility="Collapsed">
<toolkit:ListPicker.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Title}" Tag="{Binding ID}"/>
</StackPanel>
</DataTemplate>
</toolkit:ListPicker.ItemTemplate>
</toolkit:ListPicker>
</StackPanel>
What am I missing?
Upvotes: 1
Views: 460
Reputation: 8161
You just forgot to define the Full Mode Template. Since you didn't it will just show the class structure of the ItemsSource. Here the sample code for both templates, make sure you have them both.
<toolkit:ListPicker x:Name="myLP">
<!-- non full mode -->
<toolkit:ListPicker.ItemTemplate>
<DataTemplate>
<StackPanel>
<!-- YOUR XAML TAGS FOR BINDING -->
</StackPanel>
</DataTemplate>
</toolkit:ListPicker.ItemTemplate>
<!-- full mode -->
<toolkit:ListPicker.FullModeItemTemplate>
<DataTemplate>
<StackPanel>
<!-- YOUR XAML TAGS FOR BINDING -->
</StackPanel>
</DataTemplate>
</toolkit:ListPicker.FullModeItemTemplate>
</toolkit:ListPicker>
Upvotes: 3