Prevent Map reposition on InformationLayer Item click

3 posts, 1 answers
  1. Nick
    Nick avatar
    19 posts
    Member since:
    Aug 2010

    Posted 31 Aug 2010 Link to this post

    I add visual elements to the InformationLayer with clickable areas and I would like to prevent the RadMap to reposition when clicking on items on that Rad Map.
  2. Answer
    Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 02 Sep 2010 Link to this post

    Hi Nick,

    You should handle MouseLeftButtonDown event for your clickable areas. For example:

    <telerik:RadMap x:Name="radMap" 
        Center="52,0"
        ZoomLevel="6">
        <telerik:RadMap.Provider>
            <telerik:OpenStreetMapProvider />
        </telerik:RadMap.Provider>
        <telerik:InformationLayer x:Name="informationLayer">
            <Grid Width="100" Height="100" 
              telerik:MapLayer.Location="52,0"
              Background="#7F00FFFF"
              MouseLeftButtonDown="GridLeftButtonDown"
              MouseLeftButtonUp="GridLeftButtonUp">
                          
            </Grid>
        </telerik:InformationLayer>
    </telerik:RadMap>

    private void GridLeftButtonDown(object sender, MouseButtonEventArgs e)
    {
        e.Handled = true;
    }
      
    private void GridLeftButtonUp(object sender, MouseButtonEventArgs e)
    {
        // Do something on click.
    }


    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
  3. DevCraft banner
  4. Nick
    Nick avatar
    19 posts
    Member since:
    Aug 2010

    Posted 02 Sep 2010 Link to this post

    Thanks, that does the trick.

    All my controls handle their own click events, so I just needed to add e.handled = true, no need for extra code, I just didn't want the clicks to reach the Map itself.
Back to Top