I'm using a GeometryDrawing
to draw a triangle in WPF. I currently am able to bind it to my ViewModel's "Angle" property that is attached to a slider that the user can move and thus move the rectangle around an object. The problem is that I want to make the rectangle to be also able to be wider or narrower according to a specific angle that I calculate that is based on a zoom value. I'm currently unable to make the rectangle change since I don't know how to do this on a GeometryDrawing
object. Perhaps another object should be used?
The GeometryDrawing object code is this:
<GeometryDrawing Geometry="M100,100 L186.6,280 A100,100,0,0,1,13.4,280 L100,100">
<GeometryDrawing.Brush>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1" Opacity="0.25">
<GradientStopCollection>
<GradientStop Color="Black" Offset="0" />
<GradientStop Color="Transparent" Offset="0.9"/>
</GradientStopCollection>
</LinearGradientBrush>
</GeometryDrawing.Brush>
</GeometryDrawing>
The UI for the application is this (only a test project, I've made it to test the control before I implement it in my real project)
Thanks for all your help folks!
John.
Ok, I've managed to cause the arc to open and close. The way I did this was by defining both of the Arc's lines like this
And then just writing a code behind for the slider's
ValueChanged
event and recalculate the line's X position using the required angle. This resulted in the following code:I know, very messi, but that's the only way I could think of and from what I've searched online - possibly the only way there is.