C# WP8.1全景项目视图框选定索引

C# WP8.1全景项目视图框选定索引,c#,wpf,xaml,indexing,windows-phone-8.1,C#,Wpf,Xaml,Indexing,Windows Phone 8.1,如何从全景项目的视图框中获取WP8.1上的选定索引或项目?这是我的xaml和c#代码 XAML <phone:PanoramaItem Orientation="Horizontal" Background="White"> <!--Double wide Panorama with large image placeholders--> <Viewbox x:Name="Myitem" Height=

如何从全景项目的视图框中获取WP8.1上的选定索引或项目?这是我的xaml和c#代码

XAML

<phone:PanoramaItem Orientation="Horizontal" Background="White">
                <!--Double wide Panorama with large image placeholders-->
                <Viewbox x:Name="Myitem" Height="800" Margin="0,-30,0,0" Width="912" >
                    <Border Height="800" Width="912">
                        <ScrollViewer Margin="0,0,0,177">
                            <StackPanel Margin="0,0,16,0" Orientation="Vertical" VerticalAlignment="Top" Height="1722">
                                <StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
                                    <Border Height="100" Width="100" Margin="12,0,0,0">
                                        <Border.Background>
                                            <ImageBrush Stretch="Fill" ImageSource="Assets/Tiles/stib-pic0.gif"/>
                                        </Border.Background>
                                    </Border>
                                </StackPanel>
                                <StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Margin="0,12,0,0">
                                    <Border Height="100" Width="100" Margin="12,0,0,0" Tap="Border_Tap">
                                        <Border.Background>
                                            <ImageBrush Stretch="Fill" ImageSource="Assets/Tiles/stib-pic1.gif"/>
                                        </Border.Background>
                                    </Border>
                                    <Border Height="100" Width="100" Margin="12,0,0,0">
                                        <Border.Background>
                                            <ImageBrush Stretch="Fill" ImageSource="Assets/Tiles/stib-pic2.gif"/>
                                        </Border.Background>
                                    </Border>
                                    <Border Height="100" Width="100" Margin="12,0,0,0">
                                        <Border.Background>
                                            <ImageBrush Stretch="Fill" ImageSource="Assets/Tiles/stib-pic3.gif"/>
                                        </Border.Background>
                                    </Border>
                                    <Border Height="100" Width="100" Margin="12,0,0,0">
                                        <Border.Background>
                                            <ImageBrush Stretch="Fill" ImageSource="Assets/Tiles/stib-pic4.gif"/>
                                        </Border.Background>
                                    </Border>
                                </StackPanel>
                            </StackPanel>
                        </ScrollViewer>
                    </Border>
                </Viewbox>
            </phone:PanoramaItem>

我可以在internet上找到一些提示,但它们都是关于
LongListSelector

要获取所选项目的哪个控件的? 如果是全景,则可以为包含“全景”项和“使用”属性的全景控件命名


我在发布的XAML上没有任何其他控件具有所选项目的概念…

首先,您必须提供全景项目的标题名,以便轻松获取所选标题。然后在panorama selection changed事件中调用此代码段

var selectedItem = (PanoramaItem)(sender as Panorama).SelectedItem;
string item=selectedItem.Header.ToString();

正如您在上面的代码(xaml和c#示例)中所看到的,我并没有试图在selection changed事件中获取所选项目,而是在点击事件中获取所选项目。您发布的上述示例无效。Myitem item=((FrameworkElement)e.OriginalSource)。DataContext作为Myitem;
var selectedItem = (PanoramaItem)(sender as Panorama).SelectedItem;
string item=selectedItem.Header.ToString();