本文介绍了将焦点设置到PanoramaItem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法将焦点设置到在Silverlight PanoramaItem为Windows Phone 7

Is there a way to set focus to a PanoramaItem in Silverlight for Windows Phone 7?

我试过:

piResults.Focus();



在哪里piResults是PanoramaItem的名字。
我也试图给焦点在PanoramaItem的控件之一,但是这也不能工作。

Where piResults is the name of a PanoramaItem.I've also tried to give focus to one of the controls in the PanoramaItem, but that didn't work either.

如果这是不明确,我试图做到以下几点:如果按在一个PanoramaItem按钮
,你去到另一个

If this isn't clear, I'm trying to do the following:If you press a button on one PanoramaItem, you go to another.

推荐答案

你有没有尝试设置PanoramaItem指数编程一样 -

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

piResults.DefaultItem = piResults.Items[_panorama_item_index_];



墓碑在这个技术是很有用的。下面是我试过的全景控制XAML -

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];
}



希望这有助于。
indyfromoz

Hope this helps.indyfromoz

这篇关于将焦点设置到PanoramaItem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 20:17