MapEllipse doesn't draw on InformationLayer

3 posts, 0 answers
  1. Clint Singer
    Clint Singer avatar
    133 posts
    Member since:
    Oct 2012

    Posted 24 Nov 2009 Link to this post


    I am trying to add some MapEllipse controls to my map but for some reason they aren't showing up.  I am successfully drawing MapPolygons so I don't know why the ellipses won't draw.

    MapEllipse ellipse = new MapEllipse();  
    ellipse.Fill = new SolidColorBrush(Colors.Red);  
    ellipse.Stroke = new SolidColorBrush(Colors.Blue);  
    ellipse.StrokeThickness = 3;  
    ellipse.Width = 30;  
    ellipse.Height = 30;  
    ellipse.Location = polygon.Points[0]; 

    Where polygon.Points[0] is a location from one of the correctly rendering polygons.

    I was using just Ellipse correctly in one of my custom MapLayer derived classes but I wasn't able to figure out how to get regular polygons to render on that layer since I needed to interpret for each point what its value should be on the Canvas relative to the location.

    Ellipses were easy to calculate because they only have one location point which I attached via the MapLayer.SetLocation() method.

    Now that I am trying to use InformationLayer instead of a custom MapLayer I have an opposite problem since I can get the Polygons but I can't get get the ellipses (MapPolygon and MapEllipse respectively.)

    I just can't seem to win :)

  2. Clint Singer
    Clint Singer avatar
    133 posts
    Member since:
    Oct 2012

    Posted 24 Nov 2009 Link to this post

    Ok... Well I found out why my ellipses wouldn't "draw".  It turns out that the ellipse is measured in Kilometers and drawn with the location at the top left corner.  I was working at a zoomed in level such that the ellipses were drawn outside of my viewport at an enormous size. Because the top left corner is used for its origin this threw the ellipse off the screen because it was so large.

    Also, I need the location to represent the center of the ellipse.  Can one select where on the shape the hot spot is?  If not I would like to make a feature request for this.  Kind of like how one specifies a transform origin.  A value between 0..1 would be great because then I could use 0.5, 0.5 to render the location at the center of the shape.

    Actually in this case I was trying to use the ellipses as control points so really I need them to be a fixed screen size independant of the zoom.  I was trying to hack this in using MapEllipse.  Perhaps you have another idea of how I could accomplish this?

  3. Andrey
    Andrey avatar
    1681 posts

    Posted 26 Nov 2009 Link to this post

    Hi Clint Singer,

    You have to use MapPinPoint instead of MapEllipse in this case. This class is designed to represent control points. It can have an arbitrary template with any image or regular shape geometry inside. The MapPinPoint class allows you to specify hot point as well. The following example demonstrates how the pin point can be set into the point where mouse is clicked. It uses custom pin point template with geometry which looks like the doughnut.

    <UserControl x:Class="Telerik.Silverlight.RadMap.Q3._2009.MainPage"
        <Grid x:Name="LayoutRoot">
                <Style x:Key="CustomPinPoint" TargetType="layer:MapPinPoint">
                    <Setter Property="Template">
                            <ControlTemplate TargetType="layer:MapPinPoint">
                                <Border Background="{TemplateBinding Background}"
                                        BorderBrush="{TemplateBinding BorderBrush}" 
                                    <Grid Name="PART_Panel">
                                            <ColumnDefinition Width="14" />
                                            <ColumnDefinition Width="Auto" />
                                        <Path Fill="Green" Name="PART_Image">
                                                    <EllipseGeometry Center="7,7" RadiusX="3" RadiusY="3" />
                                                    <EllipseGeometry Center="7,7" RadiusX="7" RadiusY="7" />
                                        <TextBlock Grid.Column="2" Name="PART_Text" Margin="2,0,0,0" VerticalAlignment="Center" Text="{TemplateBinding Text}" />
            <map:RadMap x:Name="radMap" 
                <layer:InformationLayer Name="informationLayer" />

    private void radMap_MapMouseClick(object sender, MapMouseRoutedEventArgs eventArgs)
        MapPinPoint point = new MapPinPoint()
            Style = this.LayoutRoot.Resources["CustomPinPoint"] as Style
        MapLayer.SetLocation(point, eventArgs.Location);

    All the best,
    Andrey Murzov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top