panandzoom-nightly - Avalonia.Controls.ViewBox 2.1.0-build20190808-01
ViewBox control for Avalonia apps.
PM> Install-Package Avalonia.Controls.ViewBox -Version 2.1.0-build20190808-01 -Source https://www.myget.org/F/panandzoom-nightly/api/v3/index.json
> nuget.exe install Avalonia.Controls.ViewBox -Version 2.1.0-build20190808-01 -Source https://www.myget.org/F/panandzoom-nightly/api/v3/index.json
> dotnet add package Avalonia.Controls.ViewBox --version 2.1.0-build20190808-01 --source https://www.myget.org/F/panandzoom-nightly/api/v3/index.json
<PackageReference Include="Avalonia.Controls.ViewBox" Version="2.1.0-build20190808-01" />
Copy to clipboard
source https://www.myget.org/F/panandzoom-nightly/api/v3/index.json
nuget Avalonia.Controls.ViewBox ~> 2.1.0-build20190808-01
Copy to clipboard
> choco install Avalonia.Controls.ViewBox --version 2.1.0-build20190808-01 --source https://www.myget.org/F/panandzoom-nightly/api/v2
Import-Module PowerShellGet
Register-PSRepository -Name "panandzoom-nightly" -SourceLocation "https://www.myget.org/F/panandzoom-nightly/api/v2"
Install-Module -Name "Avalonia.Controls.ViewBox" -RequiredVersion "2.1.0-build20190808-01" -Repository "panandzoom-nightly" -AllowPreRelease
Copy to clipboard
PanAndZoom
PanAndZoom control for Avalonia
NuGet
PanAndZoom is delivered as a NuGet package.
You can find the NuGet packages here for Avalonia or by using nightly build feed:
- Add
https://www.myget.org/F/panandzoom-nightly/api/v2
to your package sources - Alternative nightly build feed
https://pkgs.dev.azure.com/wieslawsoltes/GitHub/_packaging/Nightly/nuget/v3/index.json
- Update your package using
PanAndZoom
feed
You can install the package for Avalonia
based projects like this:
Install-Package Avalonia.Controls.PanAndZoom -Pre
Package Sources
Resources
Using PanAndZoom
MainWindow.xaml
<Window x:Class="AvaloniaDemo.MainWindow"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:paz="using:Avalonia.Controls.PanAndZoom"
WindowStartupLocation="CenterScreen" UseLayoutRounding="True"
Title="PanAndZoom" Height="640" Width="640">
<Grid RowDefinitions="Auto,12,Auto,12,*,12" ColumnDefinitions="50,*,50">
<StackPanel Orientation="Vertical"
HorizontalAlignment="Center" Grid.Row="0" Grid.Column="1">
<TextBlock Text="F - Fill"/>
<TextBlock Text="U - Uniform"/>
<TextBlock Text="R - Reset"/>
<TextBlock Text="T - Toggle Stretch Mode"/>
<TextBlock Text="Mouse Wheel - Zoom to Point"/>
<TextBlock Text="Mouse Left Button Down - Pan"/>
</StackPanel>
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Center" Grid.Row="2" Grid.Column="1">
<TextBlock Text="PanButton:" VerticalAlignment="Center"/>
<ComboBox Items="{x:Static paz:ZoomBorder.ButtonNames}"
SelectedItem="{Binding #ZoomBorder.PanButton, Mode=TwoWay}"
Margin="2">
</ComboBox>
<TextBlock Text="Stretch:" VerticalAlignment="Center"/>
<ComboBox Items="{x:Static paz:ZoomBorder.StretchModes}"
SelectedItem="{Binding #ZoomBorder.Stretch, Mode=TwoWay}"
Margin="2">
</ComboBox>
<TextBlock Text="ZoomSpeed:" VerticalAlignment="Center"/>
<TextBox Text="{Binding #ZoomBorder.ZoomSpeed, Mode=TwoWay}"
TextAlignment="Center" Width="50" Margin="2"/>
<CheckBox IsChecked="{Binding #ZoomBorder.EnablePan}"
Content="EnablePan" VerticalAlignment="Center"/>
<CheckBox IsChecked="{Binding #ZoomBorder.EnableZoom}"
Content="EnableZoom" VerticalAlignment="Center"/>
</StackPanel>
<ScrollViewer Grid.Row="4" Grid.Column="1"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Auto">
<paz:ZoomBorder Name="ZoomBorder" Stretch="None" ZoomSpeed="1.2"
Background="SlateBlue" ClipToBounds="True" Focusable="True"
VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<Canvas Background="LightGray" Width="300" Height="300">
<Rectangle Canvas.Left="100" Canvas.Top="100" Width="50" Height="50" Fill="Red"/>
<StackPanel Canvas.Left="100" Canvas.Top="200">
<TextBlock Text="Text1" Width="100" Background="Red" Foreground="WhiteSmoke"/>
<TextBlock Text="Text2" Width="100" Background="Red" Foreground="WhiteSmoke"/>
</StackPanel>
</Canvas>
</paz:ZoomBorder>
</ScrollViewer>
</Grid>
</Window>
MainWindow.xaml.cs
using System.Diagnostics;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.PanAndZoom;
using Avalonia.Input;
using Avalonia.Markup.Xaml;
namespace AvaloniaDemo
{
public class MainWindow : Window
{
private readonly ZoomBorder? _zoomBorder;
public MainWindow()
{
this.InitializeComponent();
this.AttachDevTools();
_zoomBorder = this.Find<ZoomBorder>("ZoomBorder");
if (_zoomBorder != null)
{
_zoomBorder.KeyDown += ZoomBorder_KeyDown;
_zoomBorder.ZoomChanged += ZoomBorder_ZoomChanged;
}
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
private void ZoomBorder_KeyDown(object? sender, KeyEventArgs e)
{
switch (e.Key)
{
case Key.F:
_zoomBorder?.Fill();
break;
case Key.U:
_zoomBorder?.Uniform();
break;
case Key.R:
_zoomBorder?.ResetMatrix();
break;
case Key.T:
_zoomBorder?.ToggleStretchMode();
_zoomBorder?.AutoFit();
break;
}
}
private void ZoomBorder_ZoomChanged(object sender, ZoomChangedEventArgs e)
{
Debug.WriteLine($"[ZoomChanged] {e.ZoomX} {e.ZoomY} {e.OffsetX} {e.OffsetY}");
}
}
}
Getting zoom ratio
To get current zoom ratio use ZoomX
and ZoomY
properties.
Getting pan offset
To get current pan offset use OffsetX
and OffsetY
properties.
Constrain zoom ratio
To constrain zoom ratio use MinZoomX
, MaxZoomX
, MinZoomY
and MaxZoomY
properties.
Constrain pan offset
To constrain pan offset use MinOffsetX
, MaxOffsetX
, MinOffsetY
and MaxOffsetY
properties.
Enable or disable constrains
To enable or disable constrains use EnableConstrains
flag.
License
PanAndZoom is licensed under the MIT license.
-
.NETFramework 4.6.1
- Avalonia (>= 0.8.1-cibuild0002425-beta)
- Microsoft.CSharp (>= 4.5.0)
- Microsoft.NETFramework.ReferenceAssemblies (>= 1.0.0-preview.1)
- Serilog (>= 2.5.0)
- System.Memory (>= 4.5.1)
- System.Reactive (>= 4.0.0)
- System.Reactive.Core (>= 4.0.0)
- System.Reactive.Interfaces (>= 4.0.0)
- System.Reactive.Linq (>= 4.0.0)
- System.Reactive.PlatformServices (>= 4.0.0)
- System.Reactive.Windows.Threading (>= 4.0.0)
- System.ValueTuple (>= 4.5.0)
-
.NETStandard 2.0
- Avalonia (>= 0.8.1-cibuild0002425-beta)
- Microsoft.CSharp (>= 4.5.0)
- Microsoft.NETFramework.ReferenceAssemblies (>= 1.0.0-preview.1)
- Serilog (>= 2.5.0)
- System.Memory (>= 4.5.1)
- System.Reactive (>= 4.0.0)
- System.Reactive.Core (>= 4.0.0)
- System.Reactive.Interfaces (>= 4.0.0)
- System.Reactive.Linq (>= 4.0.0)
- System.Reactive.PlatformServices (>= 4.0.0)
- System.ValueTuple (>= 4.5.0)
- .NETFramework 4.6.1: 4.6.1.0
- .NETStandard 2.0: 2.0.0.0
OwnersWiesław Šoltés |
AuthorsWiesław Šoltés |
Project URLhttps://github.com/wieslawsoltes/PanAndZoom |
LicenseMIT |
TagsAvalonia ViewBox Control Xaml Managed C# |
Info0 total downloads |
0 downloads for version 2.1.0-build20190808-01 |
Download (9.91 KB) |
Found on the current feed only |
Package history
Version | Size | Last updated | Downloads | Mirrored? | |||
---|---|---|---|---|---|---|---|
3.0.999-build20200622-01 | 14.59 KB | Mon, 22 Jun 2020 08:33:28 GMT | 0 | ||||
3.0.999-build20200615-01 | 14.59 KB | Mon, 15 Jun 2020 18:02:56 GMT | 0 | ||||
2.3.999-build20200516-01 | 14.59 KB | Sat, 16 May 2020 10:53:23 GMT | 0 | ||||
2.3.999-build20200416-01 | 14.61 KB | Thu, 16 Apr 2020 06:39:04 GMT | 0 | ||||
2.3.999-build20200413-06 | 14.6 KB | Mon, 13 Apr 2020 10:45:45 GMT | 0 | ||||
2.3.999-build20200413-02 | 14.58 KB | Mon, 13 Apr 2020 10:15:23 GMT | 0 | ||||
2.3.999-build20200319-02 | 14.57 KB | Thu, 19 Mar 2020 22:36:23 GMT | 0 | ||||
2.3.2-build20200413-03 | 14.54 KB | Mon, 13 Apr 2020 10:24:43 GMT | 0 | ||||
2.3.2-build20200315-01 | 14.45 KB | Sun, 15 Mar 2020 12:27:16 GMT | 0 | ||||
2.3.1-build20200103-01 | 14.44 KB | Fri, 03 Jan 2020 16:37:16 GMT | 0 | ||||
2.3.0-build20191224-01 | 14.44 KB | Tue, 24 Dec 2019 19:26:00 GMT | 0 | ||||
2.3.0-build20191215-04 | 14.45 KB | Sun, 15 Dec 2019 08:38:16 GMT | 0 | ||||
2.3.0-build20191215-01 | 14.45 KB | Sun, 15 Dec 2019 07:32:21 GMT | 0 | ||||
2.3.0-build20191206-01 | 14.44 KB | Fri, 06 Dec 2019 08:23:14 GMT | 0 | ||||
2.3.0-build20191105-01 | 14.44 KB | Tue, 05 Nov 2019 07:34:21 GMT | 0 | ||||
2.3.0-build20191023-01 | 14.45 KB | Wed, 23 Oct 2019 06:50:40 GMT | 0 | ||||
2.3.0-build20191015-01 | 14.44 KB | Tue, 15 Oct 2019 16:51:46 GMT | 0 | ||||
2.3.0-build20191003-01 | 14.46 KB | Thu, 03 Oct 2019 15:13:04 GMT | 0 | ||||
2.3.0-build20191001-04 | 14.46 KB | Tue, 01 Oct 2019 18:52:31 GMT | 0 | ||||
2.3.0-build20191001-03 | 14.46 KB | Tue, 01 Oct 2019 13:00:08 GMT | 0 | ||||
2.3.0-build20191001-02 | 14.46 KB | Tue, 01 Oct 2019 10:00:22 GMT | 0 | ||||
2.3.0-build20191001-01 | 14.61 KB | Tue, 01 Oct 2019 08:35:04 GMT | 0 | ||||
2.3.0-build20190925-05 | 14.61 KB | Wed, 25 Sep 2019 20:54:53 GMT | 0 | ||||
2.3.0-build20190925-04 | 14.61 KB | Wed, 25 Sep 2019 20:08:23 GMT | 0 | ||||
2.3.0-build20190925-03 | 14.6 KB | Wed, 25 Sep 2019 20:06:27 GMT | 0 | ||||
2.3.0-build20190925-02 | 14.62 KB | Wed, 25 Sep 2019 19:56:01 GMT | 0 | ||||
2.3.0-build20190925-01 | 14.58 KB | Wed, 25 Sep 2019 18:16:42 GMT | 0 | ||||
2.2.1-build20190923-01 | 9.87 KB | Mon, 23 Sep 2019 17:35:22 GMT | 0 | ||||
2.2.1-build20190819-02 | 9.87 KB | Mon, 19 Aug 2019 08:29:04 GMT | 0 | ||||
2.2.1-build20190819-01 | 9.86 KB | Mon, 19 Aug 2019 08:28:31 GMT | 0 | ||||
2.2.1-build20190811-01 | 9.86 KB | Sun, 11 Aug 2019 12:54:00 GMT | 0 | ||||
2.2.1-build20190809-03 | 9.87 KB | Fri, 09 Aug 2019 13:59:01 GMT | 0 | ||||
2.2.0-build20190809-02 | 9.86 KB | Fri, 09 Aug 2019 07:51:12 GMT | 0 | ||||
2.1.0-build20190809-01 | 9.87 KB | Fri, 09 Aug 2019 07:45:42 GMT | 0 | ||||
2.1.0-build20190808-01 | 9.91 KB | Thu, 08 Aug 2019 08:52:01 GMT | 0 | ||||
2.1.0-build20190604-01 | 9.91 KB | Tue, 04 Jun 2019 16:10:08 GMT | 0 | ||||
2.1.0-build20190525-01 | 9.91 KB | Sat, 25 May 2019 19:12:18 GMT | 0 | ||||
2.1.0-build20190518-01 | 9.91 KB | Sat, 18 May 2019 21:23:20 GMT | 0 | ||||
2.1.0-build20190514-01 | 9.91 KB | Tue, 14 May 2019 06:12:54 GMT | 0 | ||||
2.1.0-build20190511-01 | 9.9 KB | Sat, 11 May 2019 12:23:22 GMT | 0 | ||||
2.1.0-build20190507-01 | 9.91 KB | Tue, 07 May 2019 17:31:54 GMT | 0 | ||||
2.1.0-build20190506-01 | 9.91 KB | Mon, 06 May 2019 16:40:26 GMT | 0 | ||||
2.1.0-build20190504-01 | 9.91 KB | Sat, 04 May 2019 11:50:25 GMT | 0 | ||||
2.1.0-build20190503-01 | 6 KB | Fri, 03 May 2019 16:20:38 GMT | 0 | ||||
2.1.0-build20190429-01 | 6 KB | Mon, 29 Apr 2019 06:43:04 GMT | 0 | ||||
2.1.0-build20190427-01 | 6 KB | Sat, 27 Apr 2019 10:28:49 GMT | 0 | ||||
2.1.0-build20190424-01 | 6 KB | Wed, 24 Apr 2019 06:06:39 GMT | 0 | ||||
2.1.0-build20190423-02 | 6 KB | Tue, 23 Apr 2019 07:40:36 GMT | 0 | ||||
2.1.0-build20190423-01 | 6 KB | Tue, 23 Apr 2019 06:44:50 GMT | 0 | ||||
2.1.0-build20190419-02 | 5.99 KB | Fri, 19 Apr 2019 11:06:54 GMT | 0 | ||||
2.1.0-build20190419-01 | 5.98 KB | Fri, 19 Apr 2019 10:37:06 GMT | 0 | ||||
2.1.0-build20190416-02 | 5.98 KB | Tue, 16 Apr 2019 16:39:18 GMT | 0 | ||||
2.0.0-build20190404-02 | 5.97 KB | Thu, 04 Apr 2019 06:15:36 GMT | 0 | ||||
2.0.0-build20190404-01 | 5.96 KB | Thu, 04 Apr 2019 06:07:10 GMT | 0 | ||||
2.0.0-build20190403-02 | 5.99 KB | Wed, 03 Apr 2019 10:24:40 GMT | 0 | ||||
2.0.0-build20190403-01 | 5.98 KB | Wed, 03 Apr 2019 07:08:52 GMT | 0 | ||||
2.0.0-build20190326-02 | 5.98 KB | Tue, 26 Mar 2019 17:41:10 GMT | 0 | ||||
2.0.0-build20190326-01 | 5.98 KB | Tue, 26 Mar 2019 17:46:14 GMT | 0 | ||||
2.0.0-build20190303-07 | 5.99 KB | Sun, 03 Mar 2019 18:15:51 GMT | 0 | ||||
2.0.0-build20190303-06 | 5.98 KB | Sun, 03 Mar 2019 17:34:23 GMT | 0 | ||||
2.0.0-build20190303-05 | 5.98 KB | Sun, 03 Mar 2019 17:33:32 GMT | 0 | ||||
2.0.0-build20190303-04 | 5.98 KB | Sun, 03 Mar 2019 17:31:56 GMT | 0 | ||||
1.0.4-build20190303-03 | 5.99 KB | Sun, 03 Mar 2019 10:25:00 GMT | 0 | ||||
1.0.4-build20190303-02 | 5.99 KB | Sun, 03 Mar 2019 10:08:47 GMT | 0 | ||||
1.0.4-build20190303-01 | 5.99 KB | Sun, 03 Mar 2019 09:02:53 GMT | 0 | ||||
1.0.4-build20190226-01 | 5.99 KB | Tue, 26 Feb 2019 09:33:29 GMT | 0 | ||||
1.0.3-build20190222-01 | 6 KB | Fri, 22 Feb 2019 14:57:29 GMT | 0 |