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

rightclick on shape

4 Answers 84 Views
Map
This is a migrated thread and some comments may be shown as answers.
Tamas
Top achievements
Rank 1
Tamas asked on 05 Dec 2010, 05:08 PM
Hi,

I tried to add an event handler to each shape displayed on my map. However only the usual Silverlight context menu pops up. I have the following code:

foreach(MapShape shape in eventArgs.Items)
{
    shape.MouseLeftButtonUp += this.ShapeMouseLeftButtonUp;
    shape.MouseRightButtonUp += this.ShapeMouseRightButtonUp;
}

The left click works fine. Do I have to do something extra to execute my event handler?

Thanks and best regards,
Tamas

4 Answers, 1 is accepted

Sort by
0
Accepted
Andrey
Telerik team
answered on 08 Dec 2010, 07:52 PM
Hello Tamas,

Unfortunately current version of the RadMap doesn't support right button events on the map shape objects. We have this functionality in our plans. You can check its availability using PITS:

http://www.telerik.com/support/pits.aspx#/public/silverlight/4270

We are planning include this feature into the upcoming service pack.

Best wishes,
Andrey Murzov
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Tamas
Top achievements
Rank 1
answered on 08 Dec 2010, 08:28 PM
Hi Andrey,

Thanks for your help!

Best regards,
Tamas
0
Sumith Jayasuriya
Top achievements
Rank 1
answered on 13 Jul 2011, 09:35 PM
When I check PITS the isue is flagged as resolved.  Is the ContextMenu now available for RadMap for Silverlight?

Thanks
Sumith
0
Andrey
Telerik team
answered on 18 Jul 2011, 02:49 PM
Hello Sumith,

Yes, RadContextMenu can be used now with RadMap for Silverlight. For example:
<UserControl x:Class="DetectShapeAtLocation.MainPage"
     mc:Ignorable="d"
     d:DesignHeight="400" d:DesignWidth="400">
    <Grid x:Name="LayoutRoot" Background="White">
        <telerik:RadMap x:Name="RadMap1"
                Center="56.1260873546439,10.1076291138805"
                ZoomLevel="3"
                MouseRightButtonDown="MapMouseRightButtonDown"
                MouseRightButtonUp="MapMouseRightButtonUp">
            <telerik:RadMap.Provider>
                <telerik:OpenStreetMapProvider />
            </telerik:RadMap.Provider>
            <telerik:RadContextMenu.ContextMenu>
                <telerik:RadContextMenu>
                    <telerik:RadMenuItem Header="Menu 1" Click="MenuItemClicked" />
                </telerik:RadContextMenu>
            </telerik:RadContextMenu.ContextMenu>
        </telerik:RadMap>
    </Grid>
</UserControl>


private Location menuLocation = Location.Empty;
 
private void MenuItemClicked(object sender, Telerik.Windows.RadRoutedEventArgs e)
{
    if (!this.menuLocation.IsEmpty)
    {
        // Perform operation
    }
}
 
private void MapMouseRightButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
    e.Handled = true;
}
 
private void MapMouseRightButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
    this.menuLocation = Location.GetCoordinates(this.RadMap1, e.GetPosition(this.RadMap1));
}

Best wishes,
Andrey Murzov
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Map
Asked by
Tamas
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Tamas
Top achievements
Rank 1
Sumith Jayasuriya
Top achievements
Rank 1
Share this question
or