UWP学习笔记之Location

UWP学习笔记之Location_第1张图片



MainPage.Xaml中:

 
    
         
            
                
            
        
    
    
         
    


PageMain.appxmanifese中:


    
	
	
     
	
 

MainPage.Xaml.cs中:

 
  
//地图定位
	private async void Location_Click(object sender, RoutedEventArgs e)
        {
            Windows.Devices.Geolocation.Geopoint position = await Library.Position(); //获得设备位置
            DependencyObject marker = Library.Marker(); //画小圆点
            Display.Children.Add(marker); 
            Windows.UI.Xaml.Controls.Maps.MapControl.SetLocation(marker, position); //设置小圆点位置
			
	//MSDN:https://msdn.microsoft.com/en-us/library/windows.ui.xaml.controls.maps.mapcontrol.setnormalizedanchorpoint.aspx
            Windows.UI.Xaml.Controls.Maps.MapControl.SetNormalizedAnchorPoint(marker, new Point(0.5, 0.5)); 
	//话说这个看不懂。。。求大神解救
			
            Display.ZoomLevel = 12; //缩放比例
            Display.Center = position;
        }



参考教程:https://comentsys.wordpress.com/2015/05/31/windows-10-universal-windows-platform-location/


强迫自己看英文吧。。。

打算做个晴天钟的Uwp。。。其实还是很好玩的。。。


//明天电钢就到了。。。等我爽个礼拜。。。

你可能感兴趣的:(UWP)