Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SelectionChanged Event for ListBox in panorama.ItemTemplate for Windows Phone?
- <phone:PhoneApplicationPage.Resources>
- <CollectionViewSource x:Key="SlideItemList" Filter="collectionView_Filter"/>
- </phone:PhoneApplicationPage.Resources>
- <!--LayoutRoot is the root grid where all page content is placed-->
- <Grid x:Name="LayoutRoot" Background="Transparent">
- <!--Panorama control-->
- <controls:Panorama x:Name="AppPano" ItemsSource="{Binding SlidesCollections}" SelectionChanged="AppPano_SelectionChanged" >
- <controls:Panorama.Background>
- <ImageBrush ImageSource="PanoramaBackground.png"/>
- </controls:Panorama.Background>
- <controls:Panorama.ItemTemplate>
- <DataTemplate>
- <Grid VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0,-100,0,0">
- <StackPanel HorizontalAlignment="Center" Height="250" Width="200" VerticalAlignment="Top">
- <TextBlock Text="{Binding Title}" HorizontalAlignment="Center" FontSize="200" Width="Auto"/>
- </StackPanel>
- <ListBox x:Name="ItemsList" ItemsSource="{Binding Source={StaticResource SlideItemList}}" Margin="0,250,0,0" VerticalAlignment="Top" SelectionChanged="ItemsList_SelectionChanged" Height="430">
- <ListBox.ItemTemplate>
- <DataTemplate>
- <StackPanel x:Name="ImgStack" HorizontalAlignment="Left" Height="430" VerticalAlignment="Top" Width="370" Margin="50,0,0,0">
- <Image Height="350" Width="360" Source="{Binding Image}"/>
- </StackPanel>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- </Grid>
- </DataTemplate>
- </controls:Panorama.ItemTemplate>
- </controls:Panorama>
- </Grid>
- private void keyItemsList_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- var listbox = (ListBox)sender;
- var conGen = listbox.ItemContainerGenerator;
- var item = (UIElement)conGen.ContainerFromIndex(listbox.SelectedIndex);
- if (item != null)
- {
- int selectedItemList = listbox.SelectedIndex;
- if (sLasListItem != selectedItemList)
- {
- // navigate to another page
- sLasListItem = selectedItemList;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement