Closed SuperJMN closed 7 years ago
@SuperJMN That would be nice, but the goal of PanAndZoom
was only to be pan and zoom control using RenderTransform
. You can emulate the behavior of ViewBox
by setting the AutoFitMode
property to Extent
or Fill
.
https://github.com/PanAndZoom/PanAndZoom/blob/master/src/Avalonia.Controls.PanAndZoom/ZoomBorder.cs#L45 https://github.com/PanAndZoom/PanAndZoom/blob/master/src/Avalonia.Controls.PanAndZoom/AutoFitMode.cs
Sample:
<Window x:Class="AvaloniaDemo.MainWindow"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:paz="clr-namespace:Avalonia.Controls.PanAndZoom;assembly=Avalonia.Controls.PanAndZoom"
UseLayoutRounding="True"
Title="Demo" Height="640" Width="640">
<Grid Background="SlateBlue">
<paz:ZoomBorder Name="zoomBorder" AutoFitMode="Extent" ZoomSpeed="1.2"
ClipToBounds="True" Background="DarkGray"
VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<Canvas Background="LightGray" Width="300" Height="300">
<Rectangle Canvas.Left="100" Canvas.Top="100" Width="50" Height="50" Fill="Red"/>
</Canvas>
</paz:ZoomBorder>
</Grid>
</Window>
A pure layout control that is useful for some scenarios and I have already missed in Avalonia :)