Search code examples
c#.netwindows-phone-8toolkitwptoolkit

toolkit:ListPicker is Null when trying to set ItemSource


Quite new to Windows Phone Applications.

Trying to create something similar to a Drop Down List, found the ListPicker. After doing some more research once it didn't work, I have come to the following code:

<toolkit:ListPicker x:Name="listActions" Grid.Row="1" Width="340" HorizontalAlignment="Left" VerticalAlignment="Center">
            <toolkit:ListPicker.ItemTemplate>
                <DataTemplate>
                    <StackPanel>
                        <TextBlock Text="{Binding Name}" />
                    </StackPanel>
                </DataTemplate>
            </toolkit:ListPicker.ItemTemplate>
            <toolkit:ListPicker.FullModeItemTemplate>
                <DataTemplate>
                    <StackPanel>
                        <TextBlock Text="{Binding Name}" />
                    </StackPanel>
                </DataTemplate>
            </toolkit:ListPicker.FullModeItemTemplate>
        </toolkit:ListPicker>

However, when I try to set the ItemSource I am getting a Null Reference exception, which is coming from the ListPicker object.

listActions.ItemsSource = Storage.Register.ActionDefinitions;

Any ideas on why this is happening or how to fix it would be greatly appreciated.

Thanks in advance


Solution

  • I'm not sure what happened. But I did all the usual things including wiping the code and re-making it identically. so weather something behind the code was missing or something I don't know. But it has started working now.

    Thanks for the help, all information, weather useful or not so much is still greatly appreciated.