I have a problem using InformationLayer.GetItemsInLocation(Location);
My InformationLayer is binded to an ObservableCollection<MyClass> myObjektCollection
<Map:InformationLayer Name="myObjektLayer" ItemsSource="{Binding myObjektCollection }" ItemTemplate="{StaticResource informationLayerFlyttObjektTemplate}" Visibility="Visible" />
While adding MyClass items to myObjektCollection , I can see that both InformationLayer(myObjektLayer) and myObjektCollection increases.
If I ,just after adding a new MyClass item to myObjektCollection, try to call
InformationLayer(myObjektLayer).GetItemsInLocation(myLocation); returns no items found.
If I later, after refreshing the map call the same method InformationLayer(myObjektLayer).GetItemsInLocation(myLocation); returns with expected items.
I know that myLocation is valid.
Ex.
myObjektItemCollection.Add(myClass);
InformationLayer(myObjektLayer).GetItemsInLocation(myLocation) - No result
In method MapMoved()
InformationLayer(myObjektLayer).GetItemsInLocation(myLocation) - OK result
Is there any method I should call on InformationLayer or Observablecollection before I call InformationLayer(myObjektLayer).GetItemsInLocation(myLocation)?
I tried:
InformationLayer(myObjektLayer).BeginInit();
myObjektItemCollection.Add(myClass);
InformationLayer(myObjektLayer).EndInit();
InformationLayer(myObjektLayer).GetItemsInLocation(myLocation)? No result