Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Have you tried the <a href="http://www.microsoft.com/maps/isdk/silverlight/#MapControlInteractiveSdk.Tutorials.UIElements.TutorialPositionLocation" rel="nofollow">interactive SDK</a> that Microsoft provides? It helped me out. </p> <p>It seems that you need only place a <code>MapLayer</code> and place <code>Pushpin</code> controls in it. You use the <code>MapLayer.Position</code> attached property to pin down anything within that map layer to the map; so that when the user moves the map it says. This attached property is of the type <code>Location</code> which is a type that is proprietary to the Bing Map control that contains both a Longitude (double) and a Latitude (double) value. If you need to bind a collection of said locations than you can use a <code>MapItemsControl</code> inside of a <code>MapLayer</code> bind its <code>ItemsSource</code> property to your collections. You can also create data template; just remember that your template root must use the <code>MapLayer.Position</code> attached property to specify its location on the map. This can be bound to any <code>Location</code>-typed value.</p> <pre><code> &lt;UserControl x:Class="MapControlInteractiveSdk.Tutorials.DataBinding.TutorialMapItemsControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:t="clr-namespace:MapControlInteractiveSdk.Tutorials.DataBinding" xmlns:m="clr-namespace:Microsoft.Maps.MapControl;assembly=Microsoft.Maps.MapControl"&gt; &lt;UserControl.Resources&gt; &lt;DataTemplate x:Key="LogoTemplate"&gt; &lt;!-- This doesn't have to be a pushpin control - it can be anything just apply the "m:MapLayer.Position" property to whatever is the root of the template. --&gt; &lt;m:Pushpin m:MapLayer.Position="{Binding Location}" /&gt; &lt;/DataTemplate&gt; &lt;/UserControl.Resources&gt; &lt;Grid x:Name="LayoutRoot" Background="White"&gt; &lt;m:Map CredentialsProvider="Your Key"&gt; &lt;m:MapLayer&gt; &lt;m:MapItemsControl x:Name="ListOfItems" ItemTemplate="{StaticResource LogoTemplate}" ItemsSource="{Binding MyLocalizedEntities}"&gt; &lt;/m:MapItemsControl&gt; &lt;/m:MapLayer&gt; &lt;m:MapLayer&gt; &lt;!-- You can have content in multiple layers: Latter layers are infront of former ones. --&gt; &lt;/m:MapLayer&gt; &lt;/m:Map&gt; &lt;/Grid&gt; &lt;/UserControl&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload