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

Map Culture/provider commands

2 Answers 86 Views
Map
This is a migrated thread and some comments may be shown as answers.
figueiredorj
Top achievements
Rank 1
figueiredorj asked on 28 Apr 2011, 01:00 PM
Hi.

I am starting to work with silvelight in a map application.

One of my concerns is about localization/culture; after playing around a bit with map control I am missing how to set culture on map control.

It takes me to another point since I have done in past one other app with bing maps - how can i use commands from provider? I had look a bit on "provider comands" but not sure on how to use it. To me it would be something like this

MapProviderBase provider = InitializeBingMapProvider(MapMode.Road, true);
provider.Commands.Add(new CommandDescription() { ... } );

However in Command description I am missing on how to declare, for this example, "Culture" where param would be something like "PT-pt".

Can someone point me the light?
Thanks

2 Answers, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 03 May 2011, 08:38 AM
Hello Ricardo,

Could you, please elaborate a bit more on what kind of localization you are asking for? Do you mean localization of the UI controls or do you mean localization of the labels are visible on the Bing map tiles?

You can add custom command to the provider as following:

<UserControl x:Class="CustomCommand.MainPage"
     mc:Ignorable="d"
     d:DesignHeight="300" d:DesignWidth="400">
      
    <UserControl.Resources>
        <DataTemplate x:Key="ButtonTemplate">
            <telerik:RadButton Command="{Binding Command}"
                   CommandParameter="{Binding CommandParameter}">
                <Grid HorizontalAlignment="Stretch">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition Width="32" />
                    </Grid.ColumnDefinitions>
  
                    <TextBlock Text="My command"
                           TextAlignment="Center" 
                           HorizontalAlignment="Stretch" 
                           Padding="7,0"
                           FontSize="11" 
                           FontWeight="Bold" />
                </Grid>
            </telerik:RadButton>
        </DataTemplate>
    </UserControl.Resources>
  
    <Grid x:Name="LayoutRoot" Background="White">
        <telerik:RadMap x:Name="radMap" 
            Center="37.7,2.2"
            ZoomLevel="8">
            <telerik:RadMap.Provider>
                <telerik:BingMapProvider Mode="Aerial" 
                     IsLabelVisible="True" 
                     ApplicationId="You_Bing_Application_Id" />
            </telerik:RadMap.Provider>
        </telerik:RadMap>
  
    </Grid>
</UserControl>

using System;
using System.Windows;
using System.Windows.Controls;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.Map;
  
namespace CustomCommand
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
  
            CommandDescription commandDescription = new CommandDescription()
            {
                Command = new DelegateCommand(ExecuteCommand),
                CommandParameter = "test",
                DataTemplate = this.Resources["ButtonTemplate"] as DataTemplate
            };
              
            this.radMap.Provider.Commands.Add(commandDescription);
        }
  
        private void ExecuteCommand(object parameter)
        {
            MessageBox.Show(string.Format("My command: {0}", parameter));
        }
    }
}


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
figueiredorj
Top achievements
Rank 1
answered on 03 May 2011, 11:06 AM
Actually I was asking for localization of the map itself.

However I have already find out that the culture PT-pt is unavailable with bing provider.
Bad Luck...

But thanks on answering.
Tags
Map
Asked by
figueiredorj
Top achievements
Rank 1
Answers by
Andrey
Telerik team
figueiredorj
Top achievements
Rank 1
Share this question
or