Navigation commands

2 posts, 1 answers
  1. Rieni De Rijke
    Rieni De Rijke avatar
    170 posts
    Member since:
    Mar 2010

    Posted 09 Mar 2011 Link to this post

    When we should make our own navigationbuttons, then what kind of command could we write in the on-click-event?

    private void GoEastClick(object sender, RoutedEventArgs e)
  2. Answer
    Andrey avatar
    1681 posts

    Posted 14 Mar 2011 Link to this post

    Hi Rieni De Rijke,

    Unfortunately the map control does not have API for navigation commands.
    You can use available API for custom navigation buttons to change center of map or you can fire appropriate KeyDown events which will be processed by map control.
    The sample code is below.

    private void GoEastClick(object sender, RoutedEventArgs e)
    private void RaiseKeyDownEvent(Key key)
        KeyEventArgs keyEventArgs = new KeyEventArgs(Keyboard.PrimaryDevice, PresentationSource.FromVisual(this.radMap), 0, key);
        keyEventArgs.RoutedEvent = UIElement.KeyDownEvent;

    private void GoEastClick(object sender, RoutedEventArgs e)
    private void MoveCenterByKey(Key key)
        Point pixelCenter = this.RecenterByKey(key);
        this.radMap.Center = Location.GetCoordinates(this.radMap, pixelCenter);
    private Point RecenterByKey(Key key)
        Point adjustmentFactor = new Point(this.ActualWidth / 3, this.ActualHeight / 3);
        Point pixelCenter = Location.LogicalToPixel(this.radMap, this.radMap.SpatialReference.GeographicToLogical(this.radMap.Center));
        switch (key)
            case Key.Left:
                pixelCenter.X -= adjustmentFactor.X;
            case Key.Right:
                pixelCenter.X += adjustmentFactor.X;
            case Key.Up:
                pixelCenter.Y -= adjustmentFactor.Y;
            case Key.Down:
                pixelCenter.Y += adjustmentFactor.Y;
        return pixelCenter;

    All the best,
    Andrey Murzov
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Back to Top