locked
Databinding and transforms RRS feed

  • Question

  • I'm sure this must have been covered already but haven't been able to find it...

    In Silverlight 2 beta 2, if I have an element with a transform like this:

        <Rectangle Width="20" Height="{Binding RectHeight}" Fill="Orange" Margin="50">
          <Rectangle.RenderTransform>
            <RotateTransform CenterX="0" CenterY="0" Angle="45" />
          </Rectangle.RenderTransform>
        </Rectangle>

    it works fine -- the rectangle height gets databound, and the transform is applied.

    If I now databind the RotateTransform.Angle property:

            <RotateTransform CenterX="0" CenterY="0" Angle="{Binding RotateAmount}" />

    Silverlight fails with the error AG_E_PARSER_BAD_PROPERTY_VALUE.

    RotateTransform.Angle is a dependency property, so I was expecting that it should be bindable.  Am I doing something wrong?  Or are Silverlight dependency properties not always bindable and if so how do we know which are and which aren't?

    Thanks!

    Tuesday, June 10, 2008 8:43 PM

Answers

  • Hey,

    Unfortunately, currently you can use databinding only when the target is a FrameworkElement.

    Regards,
    Tomek

    Wednesday, June 11, 2008 1:31 PM