This is a migrated thread and some comments may be shown as answers.

How to Use PushPin Class?

3 Answers 182 Views
Map
This is a migrated thread and some comments may be shown as answers.
Moises Casusol
Top achievements
Rank 1
Moises Casusol asked on 10 Feb 2010, 04:33 PM
Hi,

   Rad Map is awesome! nice job!. How i can use the PushPin class to add a pin with double click. I was trying something like:
private void RadMap1_MapMouseDoubleClick(object sender, MapMouseRoutedEventArgs e) 
        { 
            e.Handled = true
 
            // The location to place the pushpin at on the map. 
            Telerik.Windows.Controls.Map.VEImageryService.Location pinLocation = new Telerik.Windows.Controls.Map.VEImageryService.Location(); 
            pinLocation.Latitude = e.Location.Latitude; 
            pinLocation.Longitude = e.Location.Longitude; 
 
            // The pushpin to add to the map. 
            Pushpin pin = new Pushpin(); 
            pin.Location = pinLocation; 
 
            // Adds the pushpin to the map. 
            PinLayer.Items.Add(pin); 
 
        } 
But i had an exception with "UIElement not supported".

Best Regards,
Moises

3 Answers, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 11 Feb 2010, 01:51 PM
Hello Moises Casusol,

The information layer does not support UI elements. It supports FrameworkElement class instances.
You can change your Pushpin class to inherit from FrameworkElement. To set location you should use the attached MapLayer.Location property.
The example code is below.
private void RadMap1_MapMouseDoubleClick(object sender, MapMouseRoutedEventArgs e)  
{
    // The pushpin to add to the map. 
    Pushpin pin = new Pushpin();
  
    MapLayer.SetLocation(pin, e.Location);
  
    // Adds the element to the map. 
    PinLayer.Items.Add(pin);
}

This will become more useful in the 2010.Q1 beta that should be available next week. It will support binding to ItemsSourceProperty of the information layer.

Kind regards,
Andrey Murzov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Moises Casusol
Top achievements
Rank 1
answered on 11 Feb 2010, 09:11 PM
Hi,

   Thanks for the answer, but the PushPin class is not mine :(, it is your class in Telerik.Windows.Controls.Map.VEImageryService namespace, i was just trying to use it.

Best Regards,
0
Andrey
Telerik team
answered on 12 Feb 2010, 09:50 AM
Hello Moises Casusol,

Unfortunately the information layer does not support this Pushpin class.
Of course as workaround you can create your own class that will inherit from FrameworkElement, but the 2010.Q1 beta will contain the Pushpin class in the Telerik.Windows.Controls.Map namespace which you can use instead of the Pushpin from VEImageryService.

Greetings,
Andrey Murzov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Map
Asked by
Moises Casusol
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Moises Casusol
Top achievements
Rank 1
Share this question
or