Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/312.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# 如何通过搜索栏浏览地图?_C#_Forms_Xamarin_Maps - Fatal编程技术网

C# 如何通过搜索栏浏览地图?

C# 如何通过搜索栏浏览地图?,c#,forms,xamarin,maps,C#,Forms,Xamarin,Maps,我问错问题了对不起,让我重新开始 我有一张地图,我想把它附加到一个搜索栏上,这样当你输入一个国家时,地图就会出现在那里 这是我的代码: var theSelect = searchBar.ToString(); //my searchbars name Geocoder gc = new Geocoder (); Task<IEnumerable<Position>> result = gc.GetPosition

我问错问题了对不起,让我重新开始

我有一张地图,我想把它附加到一个搜索栏上,这样当你输入一个国家时,地图就会出现在那里

这是我的代码:

var theSelect = searchBar.ToString(); //my searchbars name

        Geocoder gc = new Geocoder ();
        Task<IEnumerable<Position>> result =
            gc.GetPositionsForAddressAsync (theSelect); //i add it here.

        IEnumerable<Position> data = await result;

        foreach (Position p in data) {


            myMap.MapType = MapType.Street; //my map's name
            myMap.MoveToRegion(new MapSpan(//add something here?));

        }
private  void FilterContacts (string filter)
    {
        EmployeeList.BeginRefresh ();

        if (string.IsNullOrWhiteSpace (filter)) {
            System.Diagnostics.Debug.WriteLine ("if1");
            EmployeeList.ItemsSource = ourPitems; //listviews name + class
        } else {
            System.Diagnostics.Debug.WriteLine ("else2");
            EmployeeList.ItemsSource = ourPitems.Where (x => x.irl1.ToLower ().Contains (filter.ToLower ()));

        }

        EmployeeList.EndRefresh ();
    }