-
-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Description
When I dynamically create multiple layers from a list, only the first layer is shown or hidden.
public partial class YMobileMap { private List<FakeVM>? _fakeLayers = []; protected async override Task OnInitializedAsync() { _fakeLayers = []; for (int i = 0; i < 10; i++) { _fakeLayers.Add(new FakeVM { Longitude = 8.413 + i / 100.0 }); } } private async Task FakeVisibleAsync() { _fakeIsVisible = !_fakeIsVisible; foreach (var item in _fakeLayers) { await item.GraphicsLayerRef.SetVisibility(_fakeIsVisible); } } }
public class FakeVM { public GraphicsLayer? GraphicsLayerRef { get; set; } public double Longitude { get; set; } }
Razor File:
`
<Map>
@{
foreach (var item in _fakeLayers)
{
<GraphicsLayer @ref="item.GraphicsLayerRef">
<Graphic Geometry="new Point(item.Longitude, 49.007)" >
@{
var color = new MapColor("red");
}
<SimpleMarkerSymbol Style="SimpleMarkerSymbolStyle.Circle" Color="color" Size="10" />
</Graphic>
</GraphicsLayer>
}
<OpenStreetMapLayer />
</Map>
</MapView>
Visible InVisible
`
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels