Question

I have a custom line shape with start and end point. The ActualWidth and ActualHeight properties however do not return the correct value, that is the difference between the points. Is there a way to override these properties in the derived class, and how would you go about doing it. I need to use the ActualWidth and ActualHeight properties since I am using an algorithm which uses those properties for other shapes.

Was it helpful?

Solution

You can't override ActualWidth and ActualHeight, they are computed:

The value is set by the layout system itself, based on an actual rendering pass

So, what you should do instead is to change how your shape behaves during rendering. Either by the way you override DefiningGeometry (assuming your shape is actually Shape) or by overriding MeasureOverride().

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top