Lets Make it Cool!

Up until now we have just been making a map. Now lets add some features.  First let’s make it display data when you hover over one of the pins. To do that we are going to use the ToolTip property of the pushpin.  We do this by setting the pushpin1.ToolTip = “Some text”.  In our case we will show
the state, capital, latitude, longitude. SouthCar

string strLat = Ds.Tables[0].Rows[i].Field<string>(“Lat”);
string strLong = Ds.Tables[0].Rows[i].Field<string>(“Log”);
string strCap = Ds.Tables[0].Rows[i].Field<string>(“Capital”);
string strState = Ds.Tables[0].Rows[i].Field<string>(“STATE”);
string locT1 = strState + “\n”;
string locT2 = strCap + “\n”;
string locT3 = strLat + “\n”;
string locT4 = strLong;

pushpin6.ToolTip = locT1 + locT2 + locT3 + locT4;

So now put this together and …

private void GetPush(DataSet Ds)
{
int rcount = Ds.Tables[0].Rows.Count;
for (int i = 0; i < rcount; i++)
{
string strLat = Ds.Tables[0].Rows[i].Field<string>(“Lat”);
string strLong = Ds.Tables[0].Rows[i].Field<string>(“Log”);
string strCap = Ds.Tables[0].Rows[i].Field<string>(“Capital”);
Double results1, results2;
results1 = Convert.ToDouble(strLat);
results2 = Convert.ToDouble(strLong);
//string iconStyle = 16;
Pushpin pushpin1 = new Pushpin();
//pushpin1.Style.Resources = Application.Current.Resources[“pushpin”];
pushpin1.PositionOrigin = PositionOrigin.Center;
//pushpin1.Location = new Location(45, -90);
pushpin1.Content = strCap;
pushpin1.Height = 55;
pushpin1.FontSize = 8;
pushpin1.Background = new SolidColorBrush(Colors.Red);
pushpin1.Foreground = new SolidColorBrush(Colors.Black);
MapLayer.SetPosition(pushpin1, new Location(results1, results2));
myMap.Children.Add(pushpin1);
}

That should give us the a pretty cool working map.  So next let’s look a making it useful!

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s