Udostępnij za pośrednictwem


FrameworkElement.Tag Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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)

Syntax

'Declaration
Public Property Tag As Object
public Object Tag { get; set; }
<frameworkElement>
  <frameworkElement.Tag>
    object*
  </frameworkElement.Tag>
</frameworkElement>
<frameworkElement Tag="string"/>

XAML Values

  • object*
    A Silverlight 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.

Remarks

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 Silverlight XAML namespaces and therefore may require mapping an external namespace in order to be introduced as XAML object elements.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

See Also

Reference

Other Resources