Skip to content

Latest commit

 

History

History
116 lines (89 loc) · 3.59 KB

DynamicMapControl.md

File metadata and controls

116 lines (89 loc) · 3.59 KB

List of Control for dynamicMap

dynamicMap

  • SelectionMode : "None", "Single", "Multiple" / Enable Selection type.
  • AutolocateButtonVisibility : "Visible", "Collapsed" / Show locate me button.
  • CompassButtonVisibility : "Visible", "Collapsed" / Show compass button when map isn't facing north. Position map facing north on tap.
  • MapStyleJson : String from JSON / Set your mapstyle here. See google map style wizard. Android Only
  • IsRotateGestureEnabled : "True", "False" / Set if user can rotate map.
  • PushpinIcon : Image file / Set image for the unselected Pushpin.
  • SelectedPushpinIcon : Image file / Set image for the selected Pushpin.
  • PushpinIconsPositionOrigin : "(double)x, (double)y" / Set the origin position for Pushpin.

Map Behavior control

  • dynamicMap:MapControlBehavior.DisableRotation : "True", "False" / Disable rotation.
  • dynamicMap:MapControlBehavior.IconWidth : float / Set width of unselected pushpin.
  • dynamicMap:MapControlBehavior.IconHeight : float / Set height of unselected pushpin.
  • dynamicMap:MapControlBehavior.SelectedIconWidth : float / Set width of selected pushpin.
  • dynamicMap:MapControlBehavior.SelectedIconHeight : float / Set height of selected pushpin.
  • dynamicMap:MapControlBehavior.CompassMargin : Thickness / Set margin of compass.
  • dynamicMap:MapControlBehavior.PushpinImageSelector : IValueConverter / Select the right image depending of parameter.

 

PushpinSelector example :

 

// YourMap.xaml

<Page.Resources>
        <ResourceDictionary>
            <converters:FromPushpinToStringConverter x:Key="PushpinToMapPin"
                                                           UnselectedValue="ms-appx:///Assets/Pushpin/inactive.png"
                                                           SelectedValue="ms-appx:///Assets/Pushpin/active.png"/>
    </ResourceDictionary>
</Page.Resources> 
// FromPushpinToStringConverter.cs

public class FromPushpinToStringConverter : ConverterBase
    {
        public string UnselectedValue { get; set; }

        public string SelectedValue { get; set; }

        protected override object Convert(object value, Type targetType, object parameter)
        {
            var Pushpin = value as PushpinEntity;

#if __ANDROID__
            var isSelected = parameter as bool? ?? false;
#else
			var isSelected = Pushpin.SafeEquals(parameter as PushpinEntity);
#endif

            return isSelected
                ? SelectedValue
                : UnselectedValue;
        }
    }

 

Multiple pushpins example :

 

// FromMultiplePushpinTypeToStringConverter.cs
public class FromMultiplePushpinTypeToStringConverter : ConverterBase
	{
        public string UnselectedValue { get; set; }

		public string Type1 { get; set; }

		public string Type2 { get; set; }

		public string Type3 { get; set; }

		public string DefaultType { get; set; }

		protected override object Convert(object value, Type targetType, object parameter)
		{
			var LocationPushpin = value as LocationPushpin;

#if __ANDROID__
			var isSelected = parameter as bool? ?? false;
#else
			var isSelected = LocationPushpin.SafeEquals(parameter as LocationPushpin);
#endif

			if (!isSelected)
			{
				return UnselectedValue;
			}

			switch (LocationPushpin.typeName)
			{
				case "pushpinType1":
					return Type1;

				case "pushpinType2":
					return Type2;

				case "pushpinType3":
					return Type3;

				default:
					return DefaultType;
			}
		}
    }