MapEllipseView ShapeFill only renders on hover

3 posts, 1 answers
  1. Chris
    Chris avatar
    7 posts
    Member since:
    Dec 2015

    Posted 04 Jan Link to this post


    I have a VisualizationLayer bound to a collection of objects, which each have their own colour accessible via a property. I've defined a MapEllipseView for (some of) the objects in the collection via an ItemTemplateSelector. The MapEllipseView has its ShapeFill property bound to the colour, and I use a converter to convert from the Color object to a MapShapeFill object, i.e. ShapeFill="{Binding Color, Converter={StaticResourceEllipseFillConverter}}".

    The issue I have is that when I add items to the collection the ellipses are rendered on the map, but the ShapeFill doesn't actually take effect until I hover over each ellipse in turn, so I  need to "colour them in" with the mouse. Through debugging I've worked out that it accesses the property when an item is added to the collection, and when I hover over it doesn't access it again, so the map has clearly already obtained the colour it should be displaying, it's just not rendering it.

    Is this a bug or is there something I can do to fix this?



  2. Answer
    Martin Ivanov
    Martin Ivanov avatar
    1446 posts

    Posted 06 Jan Link to this post

    Hi Chris,

    The bindable wrappers of RadMap (as MapEllipseView) have few known issues. One of those is that the bindings to the ShapeFill property of the wrapper, doesn't work as you would expect. In order to update the fill of the shape you will need to manually call the UseRegularFill() method of the wrapper's data object. In your case this is EllipseData. The method should be called on each update of the property.

    Instead, of using a converter, you can try an attached property bind to the color from your view model. When the color changes you can use the PropertyChanged callback of the attached property, convert the color to MapShapeFill and call the method. For example:
    <telerik:MapEllipseView local:MyMapUtilities.ShapeColor="{Binding Color}" />

    public class MyMapUtilities
        public static readonly DependencyProperty ShapeColorProperty =
              new PropertyMetadata(null, OnShapeColorChanged));
        public static Color GetShapeColor(DependencyObject obj)
            return (Color)obj.GetValue(ShapeColorProperty);
        public static void SetShapeColor(DependencyObject obj, Color value)
            obj.SetValue(ShapeColorProperty, value);
        private static void OnShapeColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
            var wrapper = (MapEllipseView)d;
            var color = (Color)e.NewValue;
            var fill = new MapShapeFill() { Fill = new SolidColorBrush(color) };
            wrapper.ShapeFill = fill;

    Telerik by Progress
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  3. Chris
    Chris avatar
    7 posts
    Member since:
    Dec 2015

    Posted 06 Jan in reply to Martin Ivanov Link to this post

    Hi Martin,

    Thanks very much for that workaround, it's now behaving as I want it to. One small change I had to make to your code was where you specify null as the default value in the property metadata. Because Color is a struct it caused an exception, so I changed it to "new Color()".


Back to Top