Maui.GoogleMaps icon indicating copy to clipboard operation
Maui.GoogleMaps copied to clipboard

ItemsSource binding doesn't work

Open RsZoli opened this issue 8 months ago • 5 comments

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]

  1. Add the Map control to a XAML page
  2. Set the ItemsSource binding to a property in your VM
  3. Populate said property

RsZoli avatar Jun 05 '24 12:06 RsZoli