IObservableMap<K, V> interface

IObservableMap<K, V> interface

Notifies listeners of dynamic changes to a map, such as when items are added or removed.

Syntax


public interface IObservableMap<K, V> : IDictionary<K, V>, 
    IEnumerable<KeyValuePair>

Type parameters

K

The type of the keys in the map.

V

The type of the values in the map.

Members

The IObservableMap interface has these types of members:

Events

The IObservableMap interface has these events.

EventDescription
MapChanged Occurs when the map changes.

 

Remarks

The IObservableMap<K,V> interface enables clients to register for notification events to IMap<K,V> collections. For example, you might use IObservableMap<K,V> when you need to keep two map structures synchronized. In this case, use the IObservableMap<K,V> interface to receive notification of changes, so that the associated data structure can be updated.

Observable collections are mainly useful for XAML data binding scenarios. For more info, see Data binding in depth.

Interface inheritance

IObservableMap<K,V> inherits IMap<K,V> and IIterable<T>. Types that implement IObservableMap<K,V> also implement the interface members of IMap<K,V> and IIterable<T>, with an IKeyValuePair<K,V> type constraint.

.NET usage

IObservableMap<K,V> isn't hidden for .NET usage. However, it's more common to use the .NET ObservableCollection<T> type (using a KeyValuePair as T) as a base class, or implement a Dictionary type or interface (generic or nongeneric) and INotifyCollectionChanged separately. If you do use IObservableMap<K,V> for .NET code, the base interfaces (and their members) project as System.Collections.Generic.IDictionary<TKey,TValue> and IEnumerable<T> (with KeyValuePair).

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.FoundationContract, introduced version 1.0

Namespace

Windows.Foundation.Collections
Windows::Foundation::Collections [C++]

Metadata

Windows.Foundation.FoundationContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8

Namespace

Windows.Foundation.Collections
Windows::Foundation::Collections [C++]

Metadata

Windows.winmd

Attributes

[Version(0x06020000)]

See also

IMap(K, V)
IIterable(IKeyValuePair)
IObservableVector<T>
Collections (C++/CX)
Data binding in depth

 

 

Show:
© 2016 Microsoft