Pinpoints

10 posts, 1 answers
  1. Sam
    Sam avatar
    103 posts
    Member since:
    Feb 2009

    Posted 16 Feb 2010 Link to this post

    I am trying to use the code from here: Adding Pin Points  and it seems to be formatted incorrectly with commas instead of semi colons and missing braces. Does anyone have a working example of adding a Pinpoint to a map in C#?

    Thanks!
    Sam


  2. Joshua Holt
    Joshua Holt avatar
    23 posts
    Member since:
    Jan 2010

    Posted 16 Feb 2010 Link to this post

    Hi Scott,
    The code in the mentioned example is formatted correctly, however, it is using C# object initializers :)

    -Josh
  3. James Foxall
    James Foxall avatar
    2 posts
    Member since:
    Oct 2006

    Posted 18 Feb 2010 Link to this post


  4. Sam
    Sam avatar
    103 posts
    Member since:
    Feb 2009

    Posted 18 Feb 2010 Link to this post

    Thanks Josh,

    I am getting build errors though.
  5. Answer
    Joshua Holt
    Joshua Holt avatar
    23 posts
    Member since:
    Jan 2010

    Posted 18 Feb 2010 Link to this post

    Hi Guys,
    I am sorry to hear that you are having issues.  I double checked the code, and it compiled fine for me in VS2008.  Here is the code I used:
      public MainPage() 
            { 
                InitializeComponent(); 
                AddPin(); 
            } 
     
            private void AddPin() 
            { 
                MapPinPoint pinPoint = new MapPinPoint() 
                { 
                    Background = new SolidColorBrush(Colors.White), 
                    Foreground = new SolidColorBrush(Colors.Red), 
                    FontSize = 14, 
                    ImageSource = new BitmapImage(new Uri("/Telerik.Silverlight.RadMap;component/Resources/Refresh.png", UriKind.Relative)), 
                    Text = "Regular Pin Point" 
                }; 
                MapLayer.SetLocation(pinPoint, new Location(37.684297, -122.06924)); 
                this.InformationLayer.Items.Add(pinPoint); 
            } 


    XAML:
    <UserControl xmlns:my="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.DataVisualization"  x:Class="Mapping.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:layer="clr-namespace:Telerik.Windows.Controls.Map;assembly=Telerik.Windows.Controls.DataVisualization" 
        mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"
        <Grid x:Name="LayoutRoot"
            <my:RadMap Name="myMap"
                <layer:InformationLayer Name="InformationLayer"/> 
            </my:RadMap> 
        </Grid> 
    </UserControl> 

    Please ensure you have the following name spaces at the top of your code page, as they are not included by default:
    using Telerik.Windows.Controls.Map; 
    using System.Windows.Media.Imaging; 


    Hope this helps :)

    -Josh

  6. Sam
    Sam avatar
    103 posts
    Member since:
    Feb 2009

    Posted 19 Feb 2010 Link to this post

    Thanks Josh it works now. I have a question, are there any built in pin point images? I assume we can use anything but the one this code generates is just a white box.

    Thanks!
    Sam
  7. Joshua Holt
    Joshua Holt avatar
    23 posts
    Member since:
    Jan 2010

    Posted 19 Feb 2010 Link to this post

    Hi Sam,
    I am glad to here it works for you now.  I just reflected the code, and didn't really find any resources for pin points.   However, you are correct in saying that you can use anything.  You are only bound to the restrictions silverlight imposes itself( no cross site images, unless properly configured).  You can easily reference a file in the root of your ClientBin by adding code like:
    new BitmapImage(new Uri("/pinPoint.png", UriKind.Relative)),

    Good luck!
    -Joshua Holt
  8. Sam
    Sam avatar
    103 posts
    Member since:
    Feb 2009

    Posted 19 Feb 2010 Link to this post

    Thanks,

    I have one more question, I seem to have lost the text next to the radio buttons for Road view and Aerial, any idea why that would happen? Screen shot attached.

  9. Joshua Holt
    Joshua Holt avatar
    23 posts
    Member since:
    Jan 2010

    Posted 19 Feb 2010 Link to this post

    Hi Sam,
    I am not sure could you post the xaml snippet for your map? Might help me find out what is going on.

    Thanks,
    Josh
  10. Sam
    Sam avatar
    103 posts
    Member since:
    Feb 2009

    Posted 19 Feb 2010 Link to this post

    I got it back, thanks for all your help!

Back to Top