DevKit.Focus.Avalonia.Sharp 0.3.0

dotnet add package DevKit.Focus.Avalonia.Sharp --version 0.3.0
                    
NuGet\Install-Package DevKit.Focus.Avalonia.Sharp -Version 0.3.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="DevKit.Focus.Avalonia.Sharp" Version="0.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DevKit.Focus.Avalonia.Sharp" Version="0.3.0" />
                    
Directory.Packages.props
<PackageReference Include="DevKit.Focus.Avalonia.Sharp" />
                    
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 DevKit.Focus.Avalonia.Sharp --version 0.3.0
                    
#r "nuget: DevKit.Focus.Avalonia.Sharp, 0.3.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.
#:package DevKit.Focus.Avalonia.Sharp@0.3.0
                    
#: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=DevKit.Focus.Avalonia.Sharp&version=0.3.0
                    
Install as a Cake Addin
#tool nuget:?package=DevKit.Focus.Avalonia.Sharp&version=0.3.0
                    
Install as a Cake Tool

DevKit.Focus.Avalonia.Sharp

Avalonia 12 adapter for DevKit.Focus.Sharp.

It supplies:

  • focus scopes backed by an Avalonia visual tree;
  • a fluent builder for component roots, default targets, owned popups, and availability;
  • UI-thread scheduling at input priority;
  • window activation focus restoration.

Simple component

public partial class TerminalView : UserControl, IKeyboardFocusSurface
{
    public TerminalView()
    {
        InitializeComponent();
        FocusScope = this.CreateKeyboardFocusScope("terminal");
    }

    public IKeyboardFocusScope FocusScope { get; }
}

Editor scope

FocusScope = AvaloniaKeyboardFocusScope
    .For(this)
    .Named("editor")
    .Default(Editor)
    .Include(FindPopup)
    .AvailableWhen(() => IsVisible)
    .Build();

Focus in any descendant of the editor root or included visual is treated as valid. TryFocusDefault() still targets Editor.

Host integration

var coordinator = new KeyboardFocusCoordinator(LogFocus);

using var restoration = window.AttachKeyboardFocusRestoration(
    coordinator,
    () => currentSurface?.FocusScope);

coordinator.PostFocus(
    terminal.FocusScope,
    new KeyboardFocusRequest(
        KeyboardFocusReason.SurfaceEntered,
        detail: "Panels -> Terminal"));

Requires Avalonia 12.1.1+.

License

MIT

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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  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

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
0.3.0 83 8/27/2026