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

2011 Q1 Custom Map provider example

4 Answers 146 Views
Map
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 22 Mar 2011, 05:33 AM
I've looked and cannot find an example for a custom map provider for the 2011 Q1 RadMap

The instructions seem to be missing a step in adding the map sources to the custom provider
http://www.telerik.com/products/silverlight/whats-new/release-history/q1-2011-version-2011-1-0315.aspx

I'm adding to the MapSources, and can see that the constructors for each source is called, but there are not appearing on the map in the source list, and no map is showing up

I see that there is a RegisterSetSourceCommand, but unsure of the parameters needed (namely the datatemplate)

Thanks in advance

4 Answers, 1 is accepted

Sort by
0
Mark
Top achievements
Rank 1
answered on 22 Mar 2011, 06:28 AM
Tweaked my implemented as per http://www.telerik.com/help/silverlight/radmap-howto-custom-provider.html (was not setting the unique ID correctly I believe)

found that the first source would be applied as default yet there was no Command buttons to check

from the demo .../#Map/CustomCommands/ and looking at .NET Reflector for Bind/OpenStreetMap Providers
I set the a template in an application resource and then called 
this.RegisterSetSourceCommand(typeof(RoadModeMapProvider), "Road", dataTemplate, new Uri("/Telerik.Windows.Controls.DataVisualization;component/themes/map/road.png", UriKind.RelativeOrAbsolute), null, null);

now working

would be good to extend the howto with multiple map sources and command buttons
0
Andrey
Telerik team
answered on 24 Mar 2011, 11:17 AM
Hi Liam,

I have attached a sample solution with multimode Open Street provider. The sample adds buttons using the RegisterSetSourceCommand method to allow users to change the map tile source.
I hope it helps.

All the best,
Andrey Murzov
the Telerik team
0
Bryant
Top achievements
Rank 1
answered on 21 Nov 2012, 12:14 PM
is there any way we can get an update to how to perform this? we recently upgraded our silverlight libraries and we were using the steps provided to create a custom map. However the resource path identified as:

Source = new Uri("/Telerik.Windows.Controls.DataVisualization;component/Themes/Map/OfficeBlack/Styles.xaml", UriKind.Relative)

is no longer valid.


Thanks
0
Andrey
Telerik team
answered on 23 Nov 2012, 02:11 PM
Hi Bryant,

The 'MapSourceButton' data template doesn't exist as a separate resource in the RadMap resource dictionary anymore. It was removed because of the changes in the RadMap styling and templating.
Currently the map source button uses default template automatically if it is not specified (null). Also the png-files were moved to the 'themes' folder.  So, you can just not use ResourceDictionary and you can use a code like the following:
private void SetupCommands()
{
    this.CommandBindingCollection.Clear();
 
    this.RegisterSetSourceCommand(
        typeof(OSMCustomMapnikSource),
        "Mapnik",
        null,
        new Uri("/Telerik.Windows.Controls.DataVisualization;component/themes/road.png", UriKind.RelativeOrAbsolute),
        null,
        null);
 
    this.RegisterSetSourceCommand(
        typeof(OSMCustomOsmarenderSource),
        "Osmarender",
        null,
        new Uri("/Telerik.Windows.Controls.DataVisualization;component/themes/aerial.png", UriKind.RelativeOrAbsolute),
        null,
        null);
}

Kind regards,
Andrey Murzov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Map
Asked by
Mark
Top achievements
Rank 1
Answers by
Mark
Top achievements
Rank 1
Andrey
Telerik team
Bryant
Top achievements
Rank 1
Share this question
or