Comments (8)
Could you check this guy post. I think he has implemented your requirements. Let me know if it helped.
#49
from blazorgooglemaps.
I did check all the previously Issues before. Maybe one option for me would be to instead of opening a infowindow, opening a modal and then style that.
Do you understand what i wanted to achive in the first place? In my perfect world i wanted to create my marker with my infowindow, adding a listener for that infowindow and whenever it´s "domready", apply some styling. Like this:
public InfoWindow infoWindow = null;
var marker = await Marker.CreateAsync(map.JsRuntime, new MarkerOptions()
{
Position = new LatLngLiteral { Lat = klev.Latitude, Lng = klev.Longitude },
Map = map.InteropObject,
Icon = ""
});
var infoWindowContent = "infowindowcontent";
await marker.AddListener("click", async () =>
{
infoWindow = await InfoWindow.CreateAsync(map.JsRuntime);
await infoWindow.SetContent(infoWindowContent);
await infoWindow.SetPosition(await marker.GetPosition());
await infoWindow.Open(map.InteropObject);
});
/// this is what i would like to add:
google.maps.event.addListener(infoWindow, 'domready', function() {
do stuff here.
});
Another thing i wonder which falls into the same category. Is it possible to add domListener to the map div? Didn´t find anything on this either. It´s done here in this example: https://developers.google.com/maps/documentation/javascript/examples/event-domListener
from blazorgooglemaps.
@Essum13
I found this:
https://stackoverflow.com/questions/5416160/listening-for-the-domready-event-for-google-maps-infowindow-class
And this:
https://developers.google.com/maps/documentation/javascript/reference/info-window
So, it is implemented in Google Maps API, yes!
Now, you are right: our implementation of InfoWindow leaks a:
public async Task<MapEventListener> AddListener(string eventName, Action handler)
implementation, so if @valentasm1 believe can be usefull, I can provide the update of InfoWindow class coherent with the same method inside Marker class (seems me underlying objects are already resilient to it).
from blazorgooglemaps.
@RobertoMilani np. You could do it. This functionality wont break all system. Just on extra method. Thank you so much.
from blazorgooglemaps.
@valentasm1 Ok, I'll do just after my "work time" ;)
@Essum13 if you want, however, due the "static behaviour" on InfoWindow (in which are injected static HTML), in a personal project I successfull mapped a "click" event on marker that cause the open of a Bootstrap modal with dynamic content (inside modal I put a custom Blazor component initialized by parameters that render a specific content of which marker Guid is only one on them (parameters)). I can share example code fragments if you like / need.
Anyway InfoWindow needs a AddListener method, I only suggest you to think "wider" -> a "static" content may be really your "target" or not (please, do not interpret my words as opinionated, it is not my intention :) )
A note:
I've not yet experimented things like JQuery HTML creation and injection inside a InfoWindow. I suppose it can be done, giving, for instance a unique id to a DIV that is used as InfoWindow content;, after several months of Blazor experience, it's for me a kind of "old way" approach and it is not the first things I have in mind to obtain a popup with dynamic content shown in response of a marker click event :)
from blazorgooglemaps.
PullRequest which should help to solve issue #55
and nuget
https://www.nuget.org/packages/BlazorGoogleMaps/0.6.10
from blazorgooglemaps.
Could i close issue?
from blazorgooglemaps.
Thanks, your implementation solved my problems. You can close the issue!
from blazorgooglemaps.
Related Issues (20)
- How do I apply the optional style to make the sample page fill the window HOT 3
- Custom controls not being added in specified position HOT 1
- WaypointOrder JsonPropery Error HOT 1
- Adding Blazor Custom Elements on to the map HOT 7
- oderv 10000 Markers HOT 1
- Warnings about deprecated fields due to `JSON.stringify` usage HOT 6
- Problem With .net 8 WebApp HOT 1
- Not able to run a Blank Project with GoogleMapsComponents HOT 1
- No RectangleList? (Cannot add previously saved Rectangle to map)
- Multi framework support
- Need server side demo with testing all components
- Did you have already Geolocation Support? HOT 3
- Need API documentation and support on Stack Overflow HOT 6
- Accessing the map object via javascript HOT 4
- Working with encoded polylines. HOT 2
- Multiple Ground Overlays HOT 3
- DrawingManager.SetDrawingMode no longer works in 3.3.2 and newer HOT 7
- Add class DragEndEvent for dragend listener (Suggestion) HOT 1
- MarkerClustering - Set Click on Zoom level; HOT 2
- polygonList not rendering the polygons HOT 9
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.