![]() |
How to create a "viewport" with Markup/XAML? |
Post Reply ![]() |
Author | |
rvoith ![]() Groupie ![]() ![]() Joined: 03 July 2003 Location: Norway Status: Offline Points: 40 |
![]() ![]() ![]() ![]() ![]() Posted: 08 September 2020 at 3:37am |
The setting is that I have a large image displayed in a markup control with a an Image-tag. I would like to display only a portion of it by using a "viewport" (in lack of a better word).
I'll try to illustrate this below, where you see the view port focusing on a part of the larger image;
![]() The viewport itself only displays what the coordinates specifies, and would look like this; ![]() I have tried to fiddle around with the XAML-elements Canvas, ScrollViewer, Viewbox and Image, but with no current success yet. Somehow I feel that the attributes ClipToBound on Image could be useful, but I seem to lack something like VerticalOffset and HorizontalOffset combined with Height and Width. Does anybody have any ideas on how to create a viewport? |
|
Best regards,
Bob Proud Programmer! |
|
![]() |
|
jpbro ![]() Senior Member ![]() ![]() Joined: 12 January 2007 Status: Offline Points: 1355 |
![]() ![]() ![]() ![]() ![]() |
Something like this appears to work:
By fixing the Border width and setting ClipToBounds='True', you create a fixed size viewport. By setting the Left & Right margins to negative numbers, you can move the enclosed image around the viewport.
|
|
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3 Language: Visual Basic 6.0 SP6 |
|
![]() |
|
rvoith ![]() Groupie ![]() ![]() Joined: 03 July 2003 Location: Norway Status: Offline Points: 40 |
![]() ![]() ![]() ![]() ![]() |
jpbro!! This works!! Thank you for trying this out!!
|
|
Best regards,
Bob Proud Programmer! |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |