FrameworkElement.Tag Property
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets an arbitrary object value that can be used to store custom information about this object.
public:
property Platform::Object ^ Tag { Platform::Object ^ get(); void set(Platform::Object ^ value); };
IInspectable Tag();
void Tag(IInspectable value);
public object Tag { get; set; }
var object = frameworkElement.tag;
frameworkElement.tag = object;
Public Property Tag As Object
<frameworkElement>
<frameworkElement.Tag>
object*
</frameworkElement.Tag>
</frameworkElement>
- or -
<frameworkElement Tag="string"/>
The intended arbitrary object value. This property has no default value.
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} markup extension, without requiring XAML namespace mapping of a specific instance property in app XAML.
Product | Versions |
---|---|
WinRT | Build 10240, Build 10586, Build 14383, Build 15063, Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100 |