/// <summary>
        /// Besides the individual customized symbols, which can be any objects of type FrameworkElement,
        /// additionally labels are added into the shape layer.
        /// </summary>
        /// <param name="frameworkElement">New shape element to insert into the shape layer.</param>
        /// <param name="animation">Optionally an animation can be specified applied to the new shape.</param>
        private void AddToLayer(FrameworkElement frameworkElement, Timeline animation = null)
        {
            #region doc:add to layer

            // Because of a different positioning of labels for objects of type MapPolylineBase compared
            // to other object types, two different implementations are available
            if (frameworkElement is MapPolylineBase)
            {
                shapeLayer.Shapes.Add(frameworkElement);
                // Create a label at the position specified in the Location property of the MapPolyline object.
                var border = CreateLabel("Hello");
                ShapeCanvas.SetLocation(border, ShapeCanvas.GetLocation(frameworkElement));
                shapeLayer.Shapes.Add(border);
            }
            else
            {
                // Arrange symbol and text label in a stack panel
                var stackPanel = new StackPanel();

                stackPanel.Children.Add(frameworkElement);
                stackPanel.Children.Add(CreateLabel("Hello"));

                // The following properties of the new object are transferred to the StackPanel for
                // correct behavior.
                ShapeCanvas.SetLocation(stackPanel, ShapeCanvas.GetLocation(frameworkElement));
                ShapeCanvas.SetAnchor(stackPanel, ShapeCanvas.GetAnchor(frameworkElement));
                ShapeCanvas.SetScale(stackPanel, ShapeCanvas.GetScale(frameworkElement));
                ShapeCanvas.SetScaleFactor(stackPanel, ShapeCanvas.GetScaleFactor(frameworkElement));

                shapeLayer.Shapes.Add(stackPanel);

                // Add the option animation
                if (animation == null)
                {
                    return;
                }

                // Set the animation to target the Center property of the stack panel object
                Storyboard.SetTarget(animation, stackPanel);
                Storyboard.SetTargetProperty(animation, new PropertyPath(ShapeCanvas.LocationProperty));

                // Create a storyboard to apply the animation.
                var sb = new Storyboard();
                sb.Children.Add(animation);
                sb.Begin();
            }
            #endregion //doc:add to layer
        }