Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

FrameworkElement.Tag property

Applies to Windows and Windows Phone

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

Syntax


public object Tag { get; set; }


<frameworkElement>
  <frameworkElement.Tag>
    object*
  </frameworkElement.Tag>
</frameworkElement>


<frameworkElement Tag="string"/>

XAML Values

object*

A Windows Runtime 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 [.NET] | Platform::Object [C++]

The intended arbitrary object value. This property has no default value.

Remarks

The scenario for the Tag property is to provide an general-purpose property on all FrameworkElement classes that supports data binding, animation and styles for itself but where the property's value does not have any implicit meaning to platform subsystems like layout, app model, text, input and so on. For example, you might put a value in the Tag property that has no meaning to the FrameworkElement where it is set, but which could be useful as an ElementName binding value to some other element that uses the FrameworkElement as a DataContext and processes the Tag value in its own way. Or you might use Tag as a way for an applied style to get a value from an arbitrary FrameworkElement parent into a specific applied template using TemplateBinding, without requiring XAML namespace mapping of a specific instance property in app XAML.

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml
Windows::UI::Xaml [C++]

Metadata

Windows.winmd

See also

FrameworkElement

 

 

Show:
© 2014 Microsoft