Hi, I’m converting a map application from VWG to WiseJ. In VWG, you could read the .MapZoomLevel property — is it possible to read the current zoom level in WiseJ?
I can set it by calling Me.mobjGoogleMap.Options.zoom = 19, but if I check the Options.Zoom value, I get System.MissingMemberException : Public member ‘zoom’ on type ‘DynamicObject’ not found.
‘Only zoom and redraw if necessary.
If Me.mobjGoogleMap.Options.zoom <> 19 Then
Me.mobjGoogleMap.Options.zoom = 19 ‘ high zoom level
However, such a dynamic object doesn’t have any of the initial values unless you initialize those values. When you try to read the zoom property before it’s initialized it simply doesn’t exist. You can check if it exists by comparing to null (or Nothing in VB) or by using the null operators, in VB it’s the If expression: If (nullable, valueIfNull), or in C# var zoom = Options.zoom ?? 4. In VB.BET Dim zoom as If (Options.zoom, 4) (or something like this).
Another way is to simply set the initial options on your google maps object including the zoom, like the example linked below.
You can also detect live when a property is changed by the user by attaching to MapPropertyChanged event. The event args carry the property name and the new value. I tried the example we have online (https://wisej.com/examples/) and when I zoom the map I get the MapPropertyChanged event and I can also read the new zoom value like this: this.googleMap.Options.zoom.
Please login first to submit.