Creating a simple SilverStream map
This tutorial will walk you through the creation of a simple Silverlight application. The application will display a world map, which you can pan and zoom around. This tutorial is one of many Telogis SilverStream tutorials.
This tutorial is broken into the following steps:
- Create a Visual Studio project
- Configure a GeoStream server
- Add a map using XAML code
Creating the project
Follow the steps below to create a Visual Studio project.
- If you have not already done so, provide a client access policy by adding the file clientaccesspolicy.xml to your Inetpub\wwwroot directory.
- Launch Visual Studio and select File | New Project...
- Select Visual C# | Silverlight from the left-hand (Project types) pane
- Name the project 'Simple Map' and click OK
- If prompted, select to host the new application in a website
- Right-click References in Solution Explorer and click Add Reference...
- Select the Browse tab and locate Telogis.GeoBase.SilverStream.dll and click OK
For an illustrated walkthrough describing how to create a SilverStream project, view the Create a SilverStream-Specific Visual Studio Project tutorial. This tutorial is summarized in the six steps above.
Configuring a GeoStream server
SilverStream obtains map and routing information from a GeoStream server. You should set the Telogis.GeoBase.Settings.ServerUrl property to the URL of a GeoStream server. If you don't do this your SilverStream application will be unable to display map data.
The easiest way to set this property is to open your project's App.xaml.cs file and modify the Application_Startup method to match the code snippet below.
private void Application_Startup(object sender, StartupEventArgs e)
{
Telogis.GeoBase.Settings.ServerUrl = "http://localhost/GeoStream";
this.RootVisual = new MainPage();
}
It's assumed you're running a GeoStream server on your local machine (the GeoBase SDK installed a GeoStream server on your local machine by default). If you are using a GeoStream server on a remote machine modify the URL as appropriate.
Adding a map
Open MainPage.xaml (found in Solution Explorer, under the simplemap project) and add the following attribute to the UserControl tag. This attribute allows your XAML code to access the Telogis.GeoBase namespace.
xmlns:GeoBase="clr-namespace:Telogis.GeoBase;assembly=Telogis.GeoBase.Silverlight"
Between the Grid tags add the following line of code. This line of code creates a new GeoBase map and places it on the grid. The map will fill the browser window because no size has been specified. The Center value specifies a latitude-longitude coordinate (roughly Los Angeles, west coast of the USA) and the Zoom value sets the initial zoom level of the map.
<GeoBase:Map Center="36,-122" Zoom="4"></GeoBase:Map>
Testing
Press F5 to build and run your application. Your default web browser will load a web page displaying a map. Click and drag the map to pan around, and scroll the mousewheel to zoom.

Next step
The next tutorial, Controlling a SilverStream map using data-bound controls, describes how to pan and zoom the map using common user interface controls (buttons and a slider).
This tutorial is one of many Telogis SilverStream tutorials.
Tagged under: silverlight maps