ZoomContentControl's Edge-Intersection With Contents

Navigation for WPF Forum

Posted 7 years ago by Justin Klein
Version: 17.1.0650
Avatar

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 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

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 7 years ago by Justin Klein
Avatar

Got it - thanks~

The latest build of this product (v24.1.2) was released 1 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.