Windows phone 7 无法使用,然后按控制键;名称“;

Windows phone 7 无法使用,然后按控制键;名称“;,windows-phone-7,wp7test,Windows Phone 7,Wp7test,我正在使用Expensify的WP7test框架 但是我的列表框有问题 <controls:PanoramaItem Header="{Binding Labels.MainMenu_Main}"> <ListBox ItemsSource="{Binding MenuItems}"> <i:Interaction.Triggers> <i:EventTrigger EventNam

我正在使用Expensify的WP7test框架

但是我的列表框有问题

<controls:PanoramaItem Header="{Binding Labels.MainMenu_Main}">
        <ListBox ItemsSource="{Binding MenuItems}">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="SelectionChanged">
                    <cmd:EventToCommand Command="{Binding MenuItemSelectedCommand}" PassEventArgsToCommand="True" />
                </i:EventTrigger>
            </i:Interaction.Triggers>

            <ListBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Name}" />
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </controls:PanoramaItem>

当我尝试使用时,我按下控件“someName”

无法将焦点设置为控制“someName”


有人知道我如何选择/按下控制按钮吗

如果要按名称引用控件,则需要为其命名。e、 g:

<controls:PanoramaItem Header="{Binding Labels.MainMenu_Main}">
    <ListBox ItemsSource="{Binding MenuItems}" Name="someName" />
</controls:PanoramaItem>


现在可以按名称引用列表框。

如果要查找单个项目,则可以在每个单独的列表项目上放置一个
auto:
标记值

e、 g:您可以使用列表项模板,如

<TextBlock Tag="{Binding AutomationTag}" Text="{Title}" />


其中AutomationTag解析为每个列表项的唯一字符串,如:
auto:1
auto:2
,等等。

您的XAML不会显示任何定义了名称的控件。您问题中的代码是否故意与实际应用程序中的代码不同?你能展示一些重现问题的东西吗?不,我的代码不是故意的不同。但是我不知道如何在我的列表框中选择一个项目。我当然可以用“然后我点击屏幕左侧的x%和顶部的y%”之类的词,但是还有其他方法吗?谢谢你的回答。我已经知道我可以在我的列表框中输入一个名字。但我似乎无论如何都找不到在列表框中的每个项目上都加上一个名字。但我通过如下定制步骤找到了解决方案:[然后(@“我点击文本”“([^\”“])”“$”)]var position=Emu.ApplicationAutomationController.GetPositionOfControlOrText(controlId);变量手势=Tap手势.TapOnPosition((int)(position.Left+position.Width/2),(int)(position.Top+position.Height/2));Emu.DisplayInputController.DoGesture(手势);}