windows-phonelistpicker

windows phone 7 listpicker itemsource template issue


I'm trying to get the listpicker to show a property that is in an iList. When i run the app, what comes up instead is the binding info.. not that property..

Here is the xaml

 <phone:PhoneApplicationPage.Resources>
    <DataTemplate x:Name="lpkItemTemplate">
        <TextBlock Text="{Binding Operation}" />
    </DataTemplate>
    <DataTemplate x:Name="lpkFullItemTemplate">
        <TextBlock Text="{Binding Operation}" />
    </DataTemplate>
</phone:PhoneApplicationPage.Resources>
 <toolkit:ListPicker x:Name="lbOperation" Header="Operations"  SelectedIndex="0" 
                        FullModeItemTemplate="{Binding lpkFullItemTemplate}"
             ItemTemplate="{Binding lpkItemTemplate}"
                        Grid.Row="5" 
                        >

and the code behind

        Dim Os As List(Of wsOperation.Operation) = e.Result
    Me.lbOperation.ItemsSource = Os

i'm thinking it is a template error because the number of rows in the list is the number that comes up when i click on the listpicker.. but the property i've asked ("Operation") is not displaying the data. Instead i get ~10 rows of wsOperation.Operation showing up.

thanks shannon

~~~~~~~~~ maybe a little more info will help with a possible solution Here is what the listpicker shows when i run this page

ProcWP.wsOperation.Operation

when i click on the above line.. this is what the listpicker shows

ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation

Solution

  • the answer to this problem was in the toolkit:ListPicker. I needed to change the {Binding lpkFullItemTemplate} to {StaticResource lpkFullItemTemplate} and same with itemTemplate

    so it looks like this now

    <toolkit:ListPicker x:Name="lbOperation" Header="Operations"  SelectedIndex="1" 
                            FullModeItemTemplate="{StaticResource lpkFullItemTemplate}"
                 ItemTemplate="{StaticResource lpkItemTemplate}"
                            Grid.Row="5" 
                            >