문제

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

도움이 되었습니까?

해결책 2

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.

다른 팁

You haven't shown enough code to confirm it but the only reason this should happen would be if you were trying to set the ItemsSource in the page constructor before InitializeComponent() is called.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top