Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.
This repository was archived by the owner on May 1, 2024. It is now read-only.

[Enhancement] PinsSource on Forms.Map #1708

@hartez

Description

@hartez

Rationale

Forms.Maps does not currently have a way to bind a list of Pins on a Map.

Implementation

Add a bindable property PinsSource to Map:

public static readonly BindableProperty PinsSourceProperty =
	BindableProperty.Create(nameof(PinsSource), typeof(IList), typeof(Map), default(IList));

public IList PinsSource
{
	get { return (IList)GetValue(PinsSourceProperty); }
	set { SetValue(PinsSourceProperty, value); }
}	

And a PinTemplate property:

public static readonly BindableProperty PinTemplateProperty = BindableProperty.Create("PinTemplate", typeof(DataTemplate), typeof(Map);

public DataTemplate PinTemplate
{
	get { return (DataTemplate)GetValue(PinTemplateProperty); }
	set { SetValue(PinTemplateProperty, value); }
}

The PinTemplate is responsible for converting the objects in the PinsSource into Xamarin.Forms.Maps.Pin objects.

Setting the PinsSource will clear out any existing pins and update the pin collection to match the source.

Backward Compatibility

This is a new property, so there should not be any backward compatibility issues.

Difficulty: Moderate

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions