Tag Property

FrameworkElement.Tag Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets or sets an arbitrary object value that can be used to store custom information about this object.

Namespace:  System.Windows
Assembly:  System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.

public Object Tag { get; set; }
<frameworkElement>
  <frameworkElement.Tag>
    object*
  </frameworkElement.Tag>
</frameworkElement>
<frameworkElement Tag="string"/>

XAML Values

object*

A Windows Phone object or a custom object that supports object element syntax (the backing type must be nonabstract and must support a public default constructor).

string

A string value (can be a true string, or input for an object type that supports type conversion from string).

Property Value

Type: System.Object
The intended value. This property has no default value.

Dependency property identifier field: TagProperty

This property is similar to Tag properties in other programming models. Tag is intended to provide a preexisting property location where you can store some basic custom information about any FrameworkElement without requiring you to derive from FrameworkElement or an intermediate class.

Because this property takes an object, a property element usage is required to set the Tag property in XAML to anything other than an object with a type converter, such as a string. Objects used in this manner are typically not within the standard XAML namespaces and therefore may require mapping an external namespace in order to be introduced as XAML object elements.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2016 Microsoft