Question

I have a Polygon in a Canvas that is normally defined like

<Polygon Points="0,0 0,24, 18,12" Fill="Red"
         Canvas.Left="44" Canvas.Top="-12" />

But I'd like to use a MultiValueConverter to determine the Canvas.Left value, but how do I specify the child node?

<Polygon.(Canvas.Left)> isn't working.

Was it helpful?

Solution

To assign an attached property as an inner tag you simply use the name of the attached property:

<Polygon>
    <Canvas.Left>
        <MultiBinding>
            ...
        </MultiBinding>
    </Canvas.Left>
</Polygon>

If you've worked with Blend and the interactions library, then you'd see this is exactly how it works there as well (here Triggers is in fact an attached property):

<Control>
    <i:Interaction.Triggers>
        ...
    </i:Interaction.Triggers>
</Control>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top