Do you need to tell the MKMapView that it need to redraw everything?
Same as you sometimes do with a view?

On Fri, Oct 5, 2012 at 1:45 PM, Arvis Lieģenieks <[email protected]> wrote:
> What I'm trying to accomplish is to update collections of MyAnnotations
> already added in MapView:
>
> Dictionary<long, MyAnnotation> _annotations;
>
> private void OnUpdate(Dictionary<uint, MyObject> updatedObjects)
> {
>     // Add or Update annotations on map
>     foreach (var pair in updatedObjects)
>     {
>         uint id = pair.Key;
>         MyObject obj = pair.Value;
>
>         double lat = obj.Latitude;
>         double lon = obj.Longitude;
>
>         if (_annotations.ContainsKey(key)) // Update existing objects
>         {
>             _annotations[id].Coordinate = new CLLocationCoordinate2D(lat,
> lon);
>             _annotations[id].Obj = obj;
>         }
>         else // Add new object to map
>         {
>             var annotation = new MyAnnotation(new
> CLLocationCoordinate2D(lat, lon), obj);
>             _annotations.Add(id, annotation);
>             InvokeOnMainThread(() => MapView.AddAnnotation(annotation));
>         }
>     }
> }
>
>
> but annotations does not get updates!!!
>
> Does MapView receive KVO notifications automaticly when
> MKAnnotation.Coordinate property has been changed and what is the
> AddAnnotationObject methode for?
>
> Falowed by this thread (
> http://monotouch.2284126.n4.nabble.com/setCoordinate-binding-td3799997.html
> )
> made my annotation (but not help - annotation did not change coordinates):
>
>         protected class MapAnnotation : MKAnnotation
>         {
>             private CLLocationCoordinate2D _coordinate;
>
>             public MapAnnotation(CLLocationCoordinate2D coordinate, MyObject
> obj)
>             {
>                 _coordinate = coordinate;
>                 Obj = obj;
>             }
>
>             public override sealed CLLocationCoordinate2D Coordinate
>             {
>                 get { return _coordinate; }
>                 set
>                 {
>                     WillChangeValue("coordinate"); // supose to triger
> MapView KVO
>                     _coordinate = value;
>                     DidChangeValue("coordinate"); // supose to triger
> MapView KVO
>                 }
>             }
>
>             public override string Title
>             {
>                 get { return Obj.MyTitle; }
>             }
>
>             public override string Subtitle
>             {
>                 get { return Obj.MySubtitle; }
>             }
>
>             public Object Obj { get; set; }
>         }
>
> _______________________________________________
> MonoTouch mailing list
> [email protected]
> http://lists.ximian.com/mailman/listinfo/monotouch
>



-- 
Nic Wise
t.  +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
b. http://www.fastchicken.co.nz/

mobileAgent (for FreeAgent): get your accounts in your pocket.
http://goo.gl/IuBU
Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
Earnest: Self-employed? Track your business expenses and income.
http://earnestapp.com
Nearest Bus: find when the next bus is coming to your stop. http://goo.gl/Vcz1p
London Bike App: Find the nearest Boris Bike, and get riding! http://goo.gl/Icp2
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to