NameScope.Add Method

Definition

Adds an item to the collection.

Overloads

Add(KeyValuePair<String,Object>)

Adds an item to the collection.

Add(String, Object)

Adds an item to the collection.

Add(KeyValuePair<String,Object>)

Adds an item to the collection.

public:
 virtual void Add(System::Collections::Generic::KeyValuePair<System::String ^, System::Object ^> item);
public void Add (System.Collections.Generic.KeyValuePair<string,object> item);
abstract member Add : System.Collections.Generic.KeyValuePair<string, obj> -> unit
override this.Add : System.Collections.Generic.KeyValuePair<string, obj> -> unit
Public Sub Add (item As KeyValuePair(Of String, Object))

Parameters

item
KeyValuePair<String,Object>

A KeyValuePair<TKey,TValue> (key is String, value is Object) that represents the name mapping to add to the XAML namescope.

Implements

Exceptions

Either or both components of item are null.

Add(String, Object)

Adds an item to the collection.

public:
 virtual void Add(System::String ^ key, System::Object ^ value);
public void Add (string key, object value);
abstract member Add : string * obj -> unit
override this.Add : string * obj -> unit
Public Sub Add (key As String, value As Object)

Parameters

key
String

The string key, which is the name of the XAML namescope mapping to add.

value
Object

The object value, which is the object reference of the XAML namescope mapping to add.

Implements

Exceptions

key or value is null.

Remarks

This method basically wraps Add so that it is not necessary to involve the KeyValuePair<TKey,TValue> type in your usage.

Names in a XAML namescope must use a particular grammar that restricts the strings you might use for inputs of NameScope API. See XamlName Grammar.

Applies to