Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 从列表框中获取x和y(windows phone 7.1)_C#_Wcf_Windows Phone 7 - Fatal编程技术网

C# 从列表框中获取x和y(windows phone 7.1)

C# 从列表框中获取x和y(windows phone 7.1),c#,wcf,windows-phone-7,C#,Wcf,Windows Phone 7,我有一个列表框,显示wcf服务中的地点、建筑、x和y的名称。如何从那里触发单击并将结果返回到地图 我的Xaml <ListBox x:Name="Results" Height="450" HorizontalAlignment="Center" VerticalAlignment="Bottom"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Margin="

我有一个列表框,显示wcf服务中的地点、建筑、x和y的名称。如何从那里触发单击并将结果返回到地图

我的Xaml

<ListBox x:Name="Results" Height="450" HorizontalAlignment="Center" VerticalAlignment="Bottom">
  <ListBox.ItemTemplate>
      <DataTemplate>

          <StackPanel Margin="0 0 0 20">
          <TextBlock Text="{Binding SearchVal}"  TextWrapping="Wrap" FontSize="{StaticResource PhoneFontSizeMediumLarge}" />
          <TextBlock Text="{Binding Category}"  TextWrapping="Wrap" FontSize="{StaticResource PhoneFontSizeMedium}" />
          <TextBlock Text="{Binding X}"  TextWrapping="Wrap" FontSize="{StaticResource PhoneFontSizeMedium}" />
          <TextBlock Text="{Binding Y}"  TextWrapping="Wrap" FontSize="{StaticResource PhoneFontSizeMedium}" />

          </StackPanel>
      </DataTemplate>
  </ListBox.ItemTemplate>
</ListBox>

单击操作背后的代码(来自其他来源的代码)

public void searchResult\u单击(对象发送者,路由目标)
{
//选择结果后,将贴图点添加到贴图中。
var selectedSearchBtn=(按钮)发送方;
var selectedVal=(字符串)selectedSearchBtn.Content;
Classes.Global.searchedValue=selectedVal;
for(int i=0;i

如何使用上述代码将X和Y取出来?

@FunksMaName如果您能帮助我,我将不胜感激=)谢谢您的点击,我已经发布了显示结果的问题,希望您能提供帮助,非常感谢!=)
 public void searchResult_Click(object sender, RoutedEventArgs e)
    {
        var button = sender as Button; //Assuming your trigger is a button UI element.

        if (button != null)
        {
            var place = button.DataContext as TestMap.Classes.Global.Place;

            if (place != null)
            {
                Classes.Global.posx = place.posx;
                Classes.Global.posy = place.posy;
            }
        }

        NavigationService.GoBack();
    }
 public void searchResult_Click(object sender, RoutedEventArgs e)
    {
        var button = sender as Button; //Assuming your trigger is a button UI element.

        if (button != null)
        {
            var place = button.DataContext as TestMap.Classes.Global.Place;

            if (place != null)
            {
                Classes.Global.posx = place.posx;
                Classes.Global.posy = place.posy;
            }
        }

        NavigationService.GoBack();
    }