Multiple Pushpins
-
8 มีนาคม 2555 16:39
I am new to Silverlight and the Bing Maps Control. Have succeeded in loading map but one Pushpin appears when 2 are coded.
XAML as follows:
<UserControl x:Class="BristolMap.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:m="clr-namespace:Microsoft.Maps.MapControl;assembly=Microsoft.Maps.MapControl" mc:Ignorable="d" d:DesignHeight="640" d:DesignWidth="480"> <Grid x:Name="LayoutRoot" Background="White"> <m:Map Name="Bris1" CredentialsProvider="My Creds" Center="51.450432, -2.525862" ZoomLevel="14"></m:Map> <m:Pushpin Name="Avalon" Location="51.450432,-2.525862" Background="Green" Content="Avalon" ToolTipService.ToolTip="Avalon Lane"></m:Pushpin> <m:Pushpin Name="Wick" Location="51.456357, -2.433805" Background="Orange" Content="Wick" ToolTipService.ToolTip="Milford Ave, Wick"></m:Pushpin> </Grid> </UserControl>When clicked I want to redirect to another aspx page.
With thanks
- แก้ไขโดย eharford 8 มีนาคม 2555 18:47
- ย้ายโดย Richard_BrundrittMicrosoft, Owner 16 มีนาคม 2555 18:46 (From:Bing Maps: Map Control and Web services Development)
ตอบทั้งหมด
-
9 มีนาคม 2555 15:38ผู้ดูแล
Concerning the 2 pushpins, you should see if the two are well positionned and if they are not overlaping each other.
Also try: http://www.microsoft.com/maps/isdk/silverlight/#MapControlInteractiveSdk.Tutorials.TutorialSimplePushpinTo open a new page while you click on a pushpin, you should bind the click event on the pushpin elements to do so.
Since it's a control in Silverlight, you can bind it from the code-behind or in the declaration.http://msdn.microsoft.com/en-us/library/microsoft.maps.mapcontrol.pushpin.aspx
http://www.microsoft.com/maps/isdk/silverlight/#MapControlInteractiveSdk.Tutorials.TutorialEvents
MVP - Bing Maps - My blog (FR): http://blogs.developpeur.org/nicoboo/ Twitter: http://twitter.com/nicolasboonaert/
- ทำเครื่องหมายเป็นคำตอบโดย Richard_BrundrittMicrosoft, Owner 10 มีนาคม 2555 13:39
-
10 มีนาคม 2555 1:16ผู้ดูแล
Make sure the Pushpins are children of the Map in your XAML. Try moving the Map closing tag after the pushpins.
<Grid x:Name="LayoutRoot" Background="White">
<m:Map Name="Bris1" CredentialsProvider="My Creds" Center="51.450432, -2.525862" ZoomLevel="14"><m:Pushpin Name="Avalon" Location="51.450432,-2.525862" Background="Green" Content="Avalon" ToolTipService.ToolTip="Avalon Lane"></m:Pushpin>
<m:Pushpin Name="Wick" Location="51.456357, -2.433805" Background="Orange" Content="Wick" ToolTipService.ToolTip="Milford Ave, Wick"></m:Pushpin>
</m:Map>
</Grid>
- แก้ไขโดย Keith KinnanModerator 10 มีนาคม 2555 1:17
- ทำเครื่องหมายเป็นคำตอบโดย Richard_BrundrittMicrosoft, Owner 10 มีนาคม 2555 13:39
-
10 มีนาคม 2555 19:20
Thanks for your suggestion. I have implemented what you suggest. My problem seems that the first Pushpin only comes up centered on the map (which is the same co-ordinates of the Centre).
<UserControl x:Class="BristolMap.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:m="clr-namespace:Microsoft.Maps.MapControl;assembly=Microsoft.Maps.MapControl" mc:Ignorable="d" d:DesignHeight="640" d:DesignWidth="480"> <Grid x:Name="LayoutRoot" Background="White"> <m:Map Name="Bris1" CredentialsProvider="My Credsl" Center="51.450432, -2.525862" ZoomLevel="14"> <m:Pushpin Name="Avalon" Location="51.4509468078613, -2.52622008323669" Background="Green" Content="Avalon" ToolTipService.ToolTip="Avalon Lane"></m:Pushpin> <m:Pushpin Name="Wick" Location="51.455020904541, -2.43373799324036" Background="Orange" Content="Wick" ToolTipService.ToolTip="Milford Ave, Wick"></m:Pushpin> <m:Pushpin Name="Fishponds" Location="51.4741172790527, -2.49118208885193" Background="Blue" Content="Fishponds" ToolTipService.ToolTip="Station Road, Fishponds"></m:Pushpin> </m:Map> </Grid> </UserControl>