Maui.GoogleMaps
Maui.GoogleMaps copied to clipboard
ItemsSource binding doesn't work
VERSIONS
- Maui.GoogleMaps - 5.0.3
- .NET SDK - 8.0.300
IDE
- [ ] Rider
- [x] Visual Studio
- [ ] Visual Studio for Mac
PLATFORMS
- [x] Android
- [x] iOS
ACTUAL BEHAVIOR
When using the map control in XAML like this:
<maps:Map x:Name="Map_Vonat" ItemsSource="{Binding Pins}" />
after populating the Pins property, nothing shows up on the map.
The Pins property like this:
public ObservableCollection<Pin> Pins { get; set; }
and i'm populating it like this:
_vm.Pins.Add(new Pin { Position = new Position(station_lat, station_lon), Icon = BitmapDescriptorFactory.FromBundle("map_station"), Label = station.Name });
However if i don't use ItemsSource, just add the Pins directly to the Map object, it works:
Map_Vonat.Pins.Add(_vm.Pins.LastOrDefault());
ACTUAL SCREENSHOTS/STACKTRACE
n/a
EXPECTED BEHAVIOR
ItemsSource binding should work
HOW TO REPRODUCE
[code and steps to reproduce]
- Add the Map control to a XAML page
- Set the ItemsSource binding to a property in your VM
- Populate said property