An attached property is a kind of dependency property which is intended to be used as a global property type and is settable on any object. It does not have conventional property wrapper and can still be used to receive notification of a value change. Unlike dependency properties, attached properties are not defined in the same class where they are used.
The main purpose of using attached properties is to allow different child elements to specify unique values of a property, which is actually defined in a parent element. For example, you can use Grid.Row, Grid.Column in any child elements of the Grid panel. Similarly, the Canvas.Left, Canvas.Top attached properties are used in any child elements of a Canvas panel.
In this recipe, we will learn how to create an Attached property and perform the operation from a different class.