Question

ZoomContentControl's Edge-Intersection With Contents

Posted 1 year ago by Avatar Justin Klein

Given a ZoomContentControl with virtual space enabled, I'd like to calculate the x-coordinates of where the content intersects with the left & right edges of the viewport.  Or put another way, the "bounds" of the content that's actually visible as you zoom & drag around.

My first thought was to bind CenterPoint & ZoomLevel as OneWayToSource, & calculate there - but that requires knowing ViewportSize, which is read-only and thus cannot be bound to the ViewModel.  As a result, I wasn't able to figure out any way to get that information without breaking MVVM.

Is there a better/easier way to calculate the visible bounds of the contents (without breaking MVVM)?

Note: I'm using 2017.1.650.0 (not available in the Product version dropdown above).

Thanks in advance :)


Comments (2)

Posted 1 year ago by Actipro Software Support - Cleveland, OH, USA

Hi Justin,

Right, you can't bind the properties you need to the view model with OneWayToSource due to some being read-only.  This article has a workaround for that WPF issue that someone developed.

If that doesn't work, perhaps you could make a class that inherits ZoomContentControl and does the work there and publishes a new dependency property you could bind to with your VM.


Actipro Software Support
Posted 1 year ago by Justin Klein

Got it - thanks~

Information The latest build of this product (2018.1 build 0672) was released 2 months ago, which was after the last post in this thread.

Add a Comment

Please log in to a validated account to post comments.