[玩转Silverlight]第五回:应用篇,在Silverlight中使用Virutal Earth地图服务
2009-03-31 12:01:47 来源:WEB开发网在Silverlight中添加调用布局
<Grid x:Name="LayoutRoot" Background="Azure">
<StackPanel Orientation="Vertical" >
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Top">
<TextBox x:Name="tbPlace" Width="200" Height="30" Text="Beijing" Margin="5" />
<Button x:Name="btnFind" Width="100" Content="Find" Height="30" Click="btnFind_Click" />
</StackPanel>
<HyperlinkButton x:Name="codeload" HorizontalAlignment="Center" Content="Code Download" Margin="10" Click="codeload_Click" />
<TextBlock HorizontalAlignment="Center" Text="2009, Anytao.com" />
</StackPanel>
</Grid>
实现具体的调用逻辑
// Release : code01, 2009/03/03
// Author : Anytao, http://www.anytao.com
// List : Page.xaml.cs
public partial class Page : UserControl
{
private VEMap map;
private VEShapeLayer layer;
public Page()
{
InitializeComponent();
Loaded += new RoutedEventHandler(Page_Loaded);
codeload.Content = "Download: " + App.Current.GetType().Namespace;
}
void Page_Loaded(object sender, RoutedEventArgs e)
{
//Create from container
map = new VEMap("myMap");
HtmlPage.RegisterScriptableObject("SLMAP", map);
//Location in Beijing
VELatLong point = new VELatLong(39.92, 116.46);
//Loading the earth
map.LoadMap(point, 11);
}
private void btnFind_Click(object sender, RoutedEventArgs e)
{
//Find a location
map.Find(string.Empty, tbPlace.Text);
}
}
Tags:Silverlight 第五回 应用
编辑录入:爽爽 [复制链接] [打 印]- ››silverlight全屏显示图片
- ››Silverlight MVVM 模式(一) 切近实战
- ››应用云平台的可用性——从新浪SAE看云平台设计
- ››应用程序的配置管理Poco
- ››Silverlight for Windows Phone 7开发系列(1):...
- ››Silverlight for Windows Phone 7开发系列(2):...
- ››Silverlight for Windows Phone 7开发系列(3):...
- ››Silverlight for Windows Phone 7开发系列(4):...
- ››应用WebSphere MQ V6 来构建企业信息总线的行业示...
- ››应用 Python 解决一些实际问题
- ››应用JScript和XML自定义无刷新多级联动菜单
- ››Silverlight for Symbian
更多精彩
赞助商链接