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 ();
}