Comments (3)
After checking samples i found this example.
Does it work for you?
Could you add you code if no.
private async Task AddMarker()
{
var mapCenter = await map1.InteropObject.GetCenter();
var marker = await Marker.CreateAsync(map1.JsRuntime, new MarkerOptions()
{
Position = mapCenter,
Map = map1.InteropObject,
Label = $"Test {markers.Count}",
Icon = new Icon()
{
Url = "https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png"
}
//Icon = "https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png"
});
await bounds.Extend(mapCenter);
var icon = await marker.GetIcon();
Console.WriteLine($"Get icon result type is : {icon.Value.GetType()}");
icon.Switch(
s => Console.WriteLine(s),
i => Console.WriteLine(i.Url),
_ => { });
markers.Push(marker);
await marker.AddListener<MouseEvent>("click", async e =>
{
var markerLabel = await marker.GetLabel();
_events.Add("click on " + markerLabel);
StateHasChanged();
await e.Stop();
});
}
from blazorgooglemaps.
Hi @valentasm1
Sorry I didn't get notification of this reply but thanks for doing that. The code which worked well for me was:
await marker.AddListener<MouseEvent>("dragend", async delegate (MouseEvent e)
{
await DoSomethingAsync(marker);
});
Thanks.
from blazorgooglemaps.
Happy to hear.
from blazorgooglemaps.
Related Issues (20)
- Advanced Marker Support HOT 4
- AdvancedMapMarker Microsoft.JSInterop.JSException: function not found HOT 1
- Enabling Dependabot for repository
- AdvancedMarkerElementOptions - Content Invalid (not an instance of Node) HOT 13
- New method services.AddBlazorGoogleMaps("YOUR_KEY_GOES_HERE"); only is used in Maps, not other components HOT 1
- Blazor web app demo HOT 1
- Removed map HTMLElement from DOM still try to render map HOT 14
- Add Support for PinElement (AdvancedMarkerElement Customization) HOT 8
- AdvancedMarker from svg HOT 4
- Add way to set AdvancedMarker properties HOT 6
- Feature: Traffic, Transit and Bicycle Layer HOT 3
- Add support for rotation on Marker icon HOT 2
- Run js quality check with ChatGpt or similar quality tool HOT 4
- Incompatible with "Blazor Web App" Template HOT 7
- Property 'marker' not found Error HOT 4
- How to locate Label on top of Icon HOT 4
- AdvancedMarkerElement needs GetPosition or equivalent. HOT 4
- Long Click Listener HOT 2
- Feature. Add AdvancedMarkerElement Clustering HOT 3
- Add ability to set AdvancedMarkerElement Draggable Property HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blazorgooglemaps.