Skip to content

How to add Icon to MarkerOptions? #11

Description

@cwschroeder

I tried to extend the MarkerOptions by an Icon object like that.

public class Icon : InteropObject
{
        [JsonIgnore]
        public IconOptions IconOptions { get; set; }

        public Icon(string iconUrl)
        {
            this.IconOptions = new IconOptions()
            {
                IconUrl = iconUrl,
            };

        }

        protected override async Task<IJSObjectReference> CreateJsObjectRef()
        {
            return await JSBinder.JSRuntime.InvokeAsync<IJSObjectReference>("L.icon", IconOptions);
        }
}

public class IconOptions
{
    public string IconUrl { get; set; }
} 

Unfortunately the JS-Runtime throws an error because createIcon() does not exist. What is missing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions