Behavior element has no 'parent' property

  • I am unable to refer to the parent item in animations as the Behavior element does not have a 'parent' property.

    @Behavior on x { NumberAnimation {duration: parent.width } }@

    It is impossible to refer to the parent in this case without the parent having a known ID that you can use. This becomes more complicated in re-parented scenarios such as the one I was attempted to design.

    Is there something I'm missing? How can I refer to variables in the parent item?

  • You are correct -- parent is a property of Item, the base class of all the visual items (but not Behavior, NumberAnimation, etc).

    I'd recommend adding a suggestion in the "bug tracker" with some examples of things you'd like to achieve that are difficult without the parent property (like your example above).


Log in to reply