2011 Q1 Custom Map provider example

5 posts, 0 answers
  1. Mark
    Mark avatar
    29 posts
    Member since:
    Aug 2010

    Posted 22 Mar 2011 Link to this post

    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
  2. Mark
    Mark avatar
    29 posts
    Member since:
    Aug 2010

    Posted 22 Mar 2011 Link to this post

    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
  3. DevCraft banner
  4. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 24 Mar 2011 Link to this post

    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
  5. Bryant
    Bryant avatar
    6 posts
    Member since:
    Mar 2011

    Posted 21 Nov 2012 Link to this post

    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
  6. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 23 Nov 2012 Link to this post

    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.

Back to Top
DevCraft banner