I have two panorama pages. The first one contains letters, the second one contains verbs that start with that letter. When user tap on the a letter, the app should redirect them to the second page with verbs. I got the HeaderItem of the Panorama to work, but not the list of the verbs. It just empty.
Here is the event on the first page:
// Navigate to the second page:
NavigationService.Navigate(new Uri("/Verbs.xaml?selectedItem=" + (alphabet.SelectedItem as ItemViewModel).ID, UriKind.Relative));
On the second page:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
if (DataContext == null)
{
string selectedIndex = "";
if (NavigationContext.QueryString.TryGetValue("selectedItem", out selectedIndex))
{
int index = int.Parse(selectedIndex);
DataContext = App.ViewModel.Items[index];
}
}
}
The XAML file of the second page:
<Grid x:Name="LayoutRoot">
<controls:Panorama Title="Verb">
<!--Panorama item one-->
<!--Binding LineOne works!-->
<controls:PanoramaItem Header="{Binding LineOne}">
<ListBox x:Name="verblist" Margin="0,0,-12,0">
<ListBox.ItemTemplate>
<DataTemplate>
<!--But this one does not work-->
<TextBlock Text="{Binding Verb1}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</controls:PanoramaItem>
<!--Panorama item two-->
<controls:PanoramaItem Header="Search">
<Grid/>
</controls:PanoramaItem>
</controls:Panorama>
</Grid>
Can you show me the problems?
Thanks!
You forgot to add items to the listbox,
or by code: