1

I have problem displaying big Ellipses in a MapLayer. The Ellipse is cut off.

In the XAML, I just add a Map with a Layer and an ellipse. In the code behind I locate the ellipse in the map. The problem appears when I pan the map to the north.

    <UserControl x:Class="PruebaEllipse.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:m="clr-namespace:Microsoft.Maps.MapControl;assembly=Microsoft.Maps.MapControl"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
    <Grid x:Name="LayoutRoot" Background="White">
        <m:Map x:Name="Mapa"  CredentialsProvider="AlT1xaWmg1CctI7..." Mode="Road" Grid.Column="0" Grid.Row="1" ZoomLevel="10" Center="-33,-54" >
            <m:MapLayer x:Name="NewPolygonLayer">
            </m:MapLayer>
            <m:MapLayer x:Name="Layer1" Loaded="Layer1_Loaded" >
                <m:MapLayer.Children>
                    <Ellipse Height="1500" HorizontalAlignment="Left" Name="ellipse1" Stroke="Black" StrokeThickness="1" VerticalAlignment="Top" Width="900" Fill="#FF895D5D" />
                </m:MapLayer.Children>
            </m:MapLayer>
        </m:Map>
    </Grid>
</UserControl>

This is the code behind:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

using Microsoft.Maps.MapControl;

namespace PruebaEllipse
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
        }

        private void Layer1_Loaded(object sender, RoutedEventArgs e)
        {
            Location trkLoc2 = new Location(-32.5, -54.0);
            MapLayer.SetPosition(ellipse1, trkLoc2);
        }
    }
}

1 Answers1

0

This is a limitation of Silverlight. If you create any control that has a size that is larger than your view port window it will be clipped. If you want to draw a circle on Bing Maps you can use the MapPolyon class and calculate a bunch of points that make up the circle. This will give you a circle that scales as you zoom the map and that doesn't get clipped by the viewport window. Here is a blog post on how to do this: http://silverlightfoundry.blogspot.co.uk/2009/06/bing-live-maps-silverlight-control-part.html

rbrundritt
  • 16,570
  • 2
  • 21
  • 46