VOOZH about

URL: https://www.nuget.org/packages/Avalonia.Labs.CommandManager/

⇱ NuGet Gallery | Avalonia.Labs.CommandManager 12.0.2




👁 Image
Avalonia.Labs.CommandManager 12.0.2

Prefix Reserved
dotnet add package Avalonia.Labs.CommandManager --version 12.0.2
 
 
NuGet\Install-Package Avalonia.Labs.CommandManager -Version 12.0.2
 
 
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="Avalonia.Labs.CommandManager" Version="12.0.2" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Avalonia.Labs.CommandManager" Version="12.0.2" />
 
Directory.Packages.props
<PackageReference Include="Avalonia.Labs.CommandManager" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Avalonia.Labs.CommandManager --version 12.0.2
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Avalonia.Labs.CommandManager, 12.0.2"
 
 
#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.
#:package Avalonia.Labs.CommandManager@12.0.2
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Avalonia.Labs.CommandManager&version=12.0.2
 
Install as a Cake Addin
#tool nuget:?package=Avalonia.Labs.CommandManager&version=12.0.2
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Avalonia.Labs.CommandManager

Experimental WPF-like implementation of RoutedCommand.

the currently supported flow is this:

sequenceDiagram
 participant RotendCommand
 participant View
 participant CommandManager
 participant ViewModel
 participant TopLevel
 TopLevel->>CommandManager: Got Focus
 CommandManager->>RotendCommand: Raise CanExecuteChanged
 RotendCommand->>View: Raise CommandManager.CanExecuteEvent
 View->>CommandManager: Raise CommandManager.CanExecuteEvent
 CommandManager->>ViewModel: ICommand.CanExecute
 CommandManager->>RotendCommand: Handle=True
 RotendCommand->>View: Raise CommandManager.ExecuteEvent
 View->>CommandManager: Raise CommandManager.ExecuteEvent
 CommandManager->>ViewModel: ICommand.Execute

Get Started

  1. Install package

    dotnet add package package Avalonia.Labs.CommandManager
    
  2. Add XML Namespace

    <UserControl xmlns="https://github.com/avaloniaui"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:lab="using:Avalonia.Labs.Catalog"
    + xmlns:rc="using:Avalonia.Labs.Input"
     mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
     xmlns:viewModels="using:Avalonia.Labs.Catalog.ViewModels"
     x:Class="Avalonia.Labs.Catalog.Views.RouteCommandView"
     x:DataType="viewModels:RouteCommandViewModel"
     HorizontalContentAlignment="Stretch"
     VerticalContentAlignment="Stretch"
     >
     ...
    </UserControl>
    
  3. Define your's RouterCommands

    public static class ApplicationCommands
    {
     public readonly static RoutedCommand Open = new RoutedCommand(nameof(Open));
     public readonly static RoutedCommand Save = new RoutedCommand(nameof(Save));
    }
    
  4. Assign your RotedCommand

     <UniformGrid Columns="2"
     Grid.Column="2">
     <Button Content="Open"
     Command="{x:Static lab:ApplicationCommands.Open}"
     CommandParameter="{Binding .}"/>
     <Button Content="Save"
     Command="{x:Static lab:ApplicationCommands.Save}"
     CommandParameter="{Binding .}"/>
     </UniformGrid>
    
  5. Binding RouterCommand to yours ViewModel

    <UserControl xmlns="https://github.com/avaloniaui"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:lab="using:Avalonia.Labs.Catalog"
     xmlns:rc="using:Avalonia.Labs.Input"
     mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
     xmlns:viewModels="using:Avalonia.Labs.Catalog.ViewModels"
     x:Class="Avalonia.Labs.Catalog.Views.RouteCommandView"
     x:DataType="viewModels:RouteCommandViewModel"
     HorizontalContentAlignment="Stretch"
     VerticalContentAlignment="Stretch"
     >
    <rc:CommandManager.CommandBindings>
     <rc:CommandBinding Command="{x:Static lab:ApplicationCommands.Open}" ExecutingCommand="{Binding Open}" />
     <rc:CommandBinding Command="{x:Static lab:ApplicationCommands.Save}" ExecutingCommand="{Binding Save}" />
    </rc:CommandManager.CommandBindings>
    ...
    </UserControl>
    

You can view full sample here.

Todo

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

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Avalonia.Labs.CommandManager:

Package Downloads
ClassIsland.Core

ClassIsland 应用核心依赖库,包括 ClassIsland 封装的一些常用控件和方法。

HelixToolkit.Avalonia.SharpDX

Helix Toolkit is a collection of 3D components for .NET. This package is based on Avalonia UI and SharpDX.

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on Avalonia.Labs.CommandManager:

Repository Stars
ClassIsland/ClassIsland
一款功能强、可定制、跨平台,适用于班级多媒体屏幕的课表信息显示工具,可以一目了然地显示各种信息。
helix-toolkit/helix-toolkit
Helix Toolkit is a collection of 3D components for .NET.
Version Downloads Last Updated
12.0.2 393 4/23/2026
12.0.0 168 4/8/2026
12.0.0-rc1 115 3/24/2026
11.3.1 680 8/14/2025
11.3.0 18,340 5/21/2025
11.2.0 937 10/20/2024
11.1.0 537 8/5/2024
11.0.10.1 414 3/19/2024
11.0.10 252 3/18/2024