Setting focus to a PanoramaItem

拥有回忆 提交于 2019-12-06 12:56:23

Have you tried setting the index of the PanoramaItem programatically, like -

piResults.DefaultItem = piResults.Items[_panorama_item_index_];

This technique is useful during Tombstoning. Here is the XAML for the Panorama control that I tried -

<!--Panorama item one-->
<controls:PanoramaItem Header="first item">
    <!--Double line list with text wrapping-->
    <Button x:Name="FirstButton" Content="Go to second item"
            Click="FirstButton_Click"/>

</controls:PanoramaItem>

<!--Panorama item two-->
<!--Use 'Orientation="Horizontal"' to enable a panel that lays out horizontally-->
<controls:PanoramaItem Header="second item">
    <!--Double line list with image placeholder and text wrapping-->
    <Button x:Name="SecondButton" Content="Go to first item"
            Click="SecondButton_Click"/>
</controls:PanoramaItem>

The events handlers are -

private void SecondButton_Click(object sender, RoutedEventArgs e)
{
  piResults.DefaultItem = piResults.Items[0];
}

private void FirstButton_Click(object sender, RoutedEventArgs e)
{
  piResults.DefaultItem = piResults.Items[1];
}

Hope this helps. indyfromoz

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!