Laminar.Avalonia.AdjustableStackPanel 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Laminar.Avalonia.AdjustableStackPanel --version 1.0.0                
NuGet\Install-Package Laminar.Avalonia.AdjustableStackPanel -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Laminar.Avalonia.AdjustableStackPanel" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Laminar.Avalonia.AdjustableStackPanel --version 1.0.0                
#r "nuget: Laminar.Avalonia.AdjustableStackPanel, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Laminar.Avalonia.AdjustableStackPanel as a Cake Addin
#addin nuget:?package=Laminar.Avalonia.AdjustableStackPanel&version=1.0.0

// Install Laminar.Avalonia.AdjustableStackPanel as a Cake Tool
#tool nuget:?package=Laminar.Avalonia.AdjustableStackPanel&version=1.0.0                

Laminar.Avalonia.AdjustableStackPanel

SelectAndMove is a lightweight, modular Avalonia control for selecting and moving controls.

Example Screenshot See source code for this example

Implementation Details

The core AdjustableStackPanel class inherits from the base Avalonia StackPanel class to gain all of the tab controls, but the key difference is every control added gets a ResizeWidget control attached to it, which raise resize events.

Resize Behaviour

The look and behaviour of the resizing is controlled by a few key classes whos behaviours can be overridden:

  • ResizeWidget is a TemplatedControl whos look can be overridden. Certain "resize zones" are marked with by naming certain elements, hovering over a resize zone will put it in a ResizerMode.
  • ResizerMode define the behaviour of each resize zone, specifying which ResizeMethod to use before and after the resizer. Default ResizeMethods are "Cascade" which tries to take space from the closest control, and "Scale" which scales all controls, but more can be defined.
  • ResizeGesture defines the overall actions which can happen when the user moves a resizer. For example, with the ResizerMode "Default" and the ResizerModifier "Move", two resizers will be moved such that one control is moved with the Cascade method before and after the control. The user can define their own ResizeGesture dictionary.

AdjustableStackPanel Layout Behaviour

The behaviour of the panel itself is dynamically determined by the its alignment and orientation. The layout pass is executed with the following method:

  • In the Measure pass, it will be measured similarly to a StackPanel. The difference being in Stretch mode it will only return the total DesiredSize of the controls, instead of the Resizer defined size. This is in convention with Avalonia.
  • Before the end of the Measure pass, queued up resize gestures are executed, and the Measured size is adjusted accordingly.
  • In the Arrange pass, the control is given the actual size it should take up. In the Stretch alignment, a Scale resize operation is carried out to ensure it takes up all the given space.
  • The controls and their resizers are then arranged top to bottom.

Resources

GitHub Repository

Nuget Package

License

AdjustableStackPanel is licensed under the MIT license

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 69 11/14/2024
1.0.0 134 10/19/2024