0

this is my code

<Canvas Name="chartCanvas1" ClipToBounds="True" Background="Beige">
      <Canvas.RenderTransform>
           <TransformGroup>
               <ScaleTransform ScaleY="-1" /> 
               <TranslateTransform Y="355" />
           </TransformGroup>
      </Canvas.RenderTransform>
</Canvas> 

i need to bind the Y="355" to a value from the code behind class in runtime and convert the coordinate system to the natural coordinate system used in mathematics.

problem is i don't know how to do that. some one please help me out.

regards, rangana.

1 Answer 1

2

You could implement a IValueConverter for this that does your conversion between the two coordinate systems. And the bind to it in XAML:

<TranslateTransform Y="{Binding SomeDataProperty Converter={StaticResource myCoordinateConverter}}" />

Alternatively if you'd use MVVM your ViewModel would take the mathematical coordinate from the model, convert it to the WPF coordinate system an provide a property for that where the view (the XAML) can directly bind against.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.