开发者

Overriding ActualWidth and ActualHeight dependency properties

开发者 https://www.devze.com 2023-03-31 01:22 出处:网络
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 o

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 overrid开发者_如何学Goe 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.


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().

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号