ASP.NET Pack Programmer's Guide
ObservableCollection.collectionChanged Event
See Also
 





Occurs when an item is added, removed, changed, moved, or the entire list is refreshed.

Namespace: MindFusion.Mapping
Package: ObservableCollection.js

 Syntax

JavaScript  Copy Code

EventDispatcher collectionChanged

 Event Data

The event handler method receives the following arguments:
sender
An ObservableCollection instance, which is the source of the event. This object will be passed to the handler function as the first argument.
args
A NotifyCollectionChangedEventArgs instance, which contains event data. This object will be passed to the handler function as the second argument.

 Example

The following code creates a new DecorationLayer and adds a new Marker to it. Then it handles the collectionChanged event of the decorations property of the DecorationLayer. The decorations property is of type ObservableCollection.

JavaScript  Copy Code

var m = MindFusion.Mapping;

var markers = new m.DecorationLayer("Images");

// create some markers with images
var mark = new m.Marker(new m.LatLong(-22.951916, -43.210487));
mark.imageSrc = "./images/christ_redeemer.png";
mark.text = "Christ the Redeemer";
markers.decorations.add(mark);

markers.decorations.collectionChanged.addEventListener(handleCollectionChanged);


function (handleCollectionChanged) (sender, args )
{
     if(args.newItems.contains(mark))
     {
          //do something
     }
}

 See Also

ObservableCollection Members
ObservableCollection Class
MindFusion.Mapping Namespace