问题描述:

I would like to know the best way on intercepting a DP value and scale it by a certain factor in a way as XAML friendly as possible, without subclassing the control. Just to explain better, I'm working on a behavior that manages zoom on canvas ( and derived ) objects, and I want being easy to "unscale" certain DP ( for example line thickness ) by the current scale factor, so I would like some XAML friendly way to let the user specify which property unscale, and let me intercept to apply the proper scaling factor, that I know as the agent who is providing the zoom.

Thanks in advance,

网友答案:

If what you are trying to achieve is constant-width strokes when zooming in/out try zooming using transform on your Geometry objects instead of on your Visual/FrameworkElement objects.

Good luck!

网友答案:

I'm using OverrideMetadata to do the job I need.

相关阅读:
Top