Attached properties are not inherited in the way members or methods of classes are inherited.
When we talk about attached properties being inherited we usually refer to the value of an attached property set on a parent element of the visual tree also applies to the children of that node (unless overridden with a new value).
Think of the
Grid.Row
attached property for example, you can set if for
Label
s and
Checkbox
es and so on, but that doesn't mean that these controls somehow inherit the attached property from
Grid
.
Instead, it's the responsibility of the
Grid
class to check if the
Grid.Row
value is set (or use the default value) when doing layout and use the that value to correctly position the element.
In your example;
InkCanvas.SetTop(image, y);
InkCanvas.SetLeft(image, x);
InkCanvas.Children.Add(image);
The variables
x
and
y
are
attached to
image
, and then
InkCanvas
looks at those during it's
MeasureOverride
and
ArrangeOverride
passes. This means that if your
CustomInkCanvas
not overrides those methods from
InkCanvas
then the values are not observed.
Hope this helps,
Fredrik