LawTreeView 0.1.1

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

LawTreeView

An Avalonia 11 tree-view control for .NET 9 with built-in drag-drop reordering, icons, selection, keyboard navigation, hover/selection styling, and a context menu.

Install

dotnet add package LawTreeView

Quick start

<Window xmlns="https://github.com/avaloniaui"
        xmlns:law="clr-namespace:LawTreeView.Controls;assembly=LawTreeView">
    <law:LawTreeView Name="Tree" AllowDragDrop="True" />
</Window>
using LawTreeView.Controls;

Tree.ItemsSource = new ObservableCollection<LawTreeViewItem>
{
    new()
    {
        DisplayMember = "Cases",
        Children =
        {
            new LawTreeViewItem { DisplayMember = "Smith v. Jones" },
            new LawTreeViewItem { DisplayMember = "Doe v. Acme Corp" },
        }
    }
};

Tree.SelectionChanged += (_, e) => Console.WriteLine($"Selected: {e.NewItem?.DisplayMember}");
Tree.ItemDropped += (_, e) =>
    Console.WriteLine($"Moved {e.Item.DisplayMember}: " +
                      $"{e.SourceParent?.DisplayMember ?? "(root)"}[{e.SourceIndex}] -> " +
                      $"{e.TargetParent?.DisplayMember ?? "(root)"}[{e.TargetIndex}]");

Properties

Property Type Notes
ItemsSource IEnumerable<LawTreeViewItem>? Use ObservableCollection for live top-level mutations
SelectedItem LawTreeViewItem? Two-way bindable
AllowDragDrop bool Default false
ItemBackground IBrush? Per-row background
ItemHoverBackground IBrush? Background under the pointer
SelectedItemBackground IBrush? Selected row background
SelectedItemForeground IBrush? Selected row foreground (also recolors Geometry icons)

Inherited Avalonia properties — FontFamily, FontSize, FontWeight, FontStyle, Foreground, Background — cascade to all items.

Events

  • SelectionChanged(LawTreeViewSelectionChangedEventArgs)OldItem, NewItem
  • ItemDropped(LawTreeViewItemDroppedEventArgs)Item, SourceParent, SourceIndex, TargetParent, TargetIndex

LawTreeViewItem

  • DisplayMember (string)
  • Children (ObservableCollection<LawTreeViewItem>)
  • IsExpanded, IsSelected
  • Icon (object — accepts Geometry for vectors or Bitmap for raster)
  • ExpandAll(), CollapseAll()

Keyboard

Key Action
↑ ↓ Move selection
Collapse, or jump to parent
Expand, or jump to first child
Home / End First / last visible item
Enter / Space Toggle expand/collapse

License

MIT

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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 was computed.  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.1.1 90 5/10/2026

Initial release.