Not a bug, but an error.
I need to add custom properties to my pin. How I normally would do it is to derive from the pin class and add the custom properties, but that is not possible here as the pin class is sealed.
How can I add custom properties to the pin class??
Can I open the code in the nuget package and unseal the class and if so how? Or will that cause additional errors?
public class CustomGPin : Xamarin.Forms.GoogleMaps.Pin //cannot derive from sealed type pin
{
public string CustomProperty1 { get; set; }
public string CustomProperty2 { get; set; }
public string CustomProperty3 { get; set; }
public string CustomProperty4 { get; set; }
}
// paste stacktrace
I would like to add custom properties to the pin class.
Adding custom properties to pin class are quite essential? So I would assume there is another way to do it?
Reprode by trying to derive
public class CustomGPin : Xamarin.Forms.GoogleMaps.Pin //cannot derive from sealed type pin
{
public string CustomProperty1 { get; set; }
public string CustomProperty2 { get; set; }
public string CustomProperty3 { get; set; }
public string CustomProperty4 { get; set; }
}
Yes, Pin is sealed class.
You can use Pin.Tag as object property.
class YourData
{
public string CustomProperty1 { get; set; }
public string CustomProperty2 { get; set; }
public string CustomProperty3 { get; set; }
public string CustomProperty4 { get; set; }
}
pin.Tag = new YourData
{
CustomProperty1 = "A",
CustomProperty2 = "B",
CustomProperty3 = "C",
CustomProperty4 = "D"
};
Why did you opt into sealing the class Pin as compared to Xamarin.Forms.Maps' Pin type ?
Hi ! I switch from Xamarin.Forms.Map and as cannot derive CustomPin so I store my object in Tag. But i got a small issue where i can't to store object in Tag through Binding and use them in Custom Renderer. Any issue if make Tag a Bindable Property ?
Hi,
Is there some news on the tag property bindable?
Thanks,
Most helpful comment
Hi ! I switch from Xamarin.Forms.Map and as cannot derive CustomPin so I store my object in Tag. But i got a small issue where i can't to store object in Tag through Binding and use them in Custom Renderer. Any issue if make Tag a Bindable Property ?