AB4D Forum
Binding a Viewport to ZoomPanel - Printable Version

+- AB4D Forum (https://forum.ab4d.com)
+-- Forum: Products Forums (https://forum.ab4d.com/forumdisplay.php?fid=4)
+--- Forum: ZoomPanel (https://forum.ab4d.com/forumdisplay.php?fid=8)
+--- Thread: Binding a Viewport to ZoomPanel (/showthread.php?tid=4114)

Binding a Viewport to ZoomPanel - RUL - 07-05-2018


I want to show a customized svg in a ZoomPanel with a customized Viewport, while having a clean MVVM pattern.

I'm currently loading an svg in the ViewModel like so: 
var readerSvg = new Ab2d.ReaderSvg();
svgViewbox = readerSvg.Read(svgFilePath);

This gives me a System.Windows.Controls.Viewbox, which I need to loop through its Children to find customize certain parts of the SVG. This works perfectly.

After that, I could add the svgViewbox to a ZoomPanel, via the Content-Tag:

<ab2d:ZoomPanel x:Name="MyZoomPanel" Content="{Binding SvgViewbox}" />

 then how to set a Viewport in the form of a Rect?
Rect rectViewport = new Rect(xFactor, yFactor, widthFactor, heightFactor)

I already know the method SetViewboxNow(rectViewport);
But i want to bind this rectViewport in XAML, to stay true to MVVM pattern.
Thanks in advance.