Virtual Earth Silverlight Map Control CTP

投稿日 : 2009年3月27日 0:52

 Virtual Earth Silverlight Map Control CTP がMIX09で発表されたようです。Microsoft Connect で登録するとDLLがダウンロードできます。おためしはこちら → Interactive SDK

 以前からVirtual Earth Map ControlとWPFやDeepZoomと組み合わせたライブラリはCodePlexなどで公開されていましたが、マイクロソフトから正式にアナウンスされた形でしょうか。これは良いわ~。VB.NETで書けちゃう点で。楽しい。

 まぁ、まだ全然さわってないんですけどね……。

Virtual Earth Silverlight Map Control CTP

 Connectからもリンクされている解説記事、Virtual Earth Silverlight Map Control をみるとさわった気になってしまう。

 簡単な例。Visual Studio 2008でSilverlightプロジェクトを作成。ダウンロードしたCTPのDLLを参照します。

 XAML側。

<UserControl x:Class="veslctp.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:VirtualEarth="clr-namespace:Microsoft.VirtualEarth.MapControl;assembly=Microsoft.VirtualEarth.MapControl">
    <Grid x:Name="LayoutRoot" Background="White">
        <VirtualEarth:Map x:Name="MyMap" Height="400" Width="500" />
    </Grid>
</UserControl>

 コードビハインド。

Imports Microsoft.VirtualEarth.MapControl
Partial Public Class Page
    Inherits UserControl

    Public Sub New()
        InitializeComponent()
    End Sub

    Private Sub MyMap_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles MyMap.Loaded
        Dim spec = New MapViewSpecification(New Location(36.36601, -115.242462), 10)
        MyMap.View = spec
    End Sub
End Class

 ロード時に指定した経緯度に移動するだけの簡単なものです。住所で座標指定するには、Interactive SDKを見るとMap Controlではなく Virtual Earth Web Services を使用すれば良いみたいですね(Webサービスの参照で)。

コメントの入力
タイトル
名前
Url
コメント