HopDev.Tree.EntityFramework 2.1.0

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

HopDev.Tree

A cross-platform hierarchical tree control for .NET MAUI, Avalonia, WPF, and Blazor with built-in database persistence, CRUD operations, drag-and-drop, search, checkboxes, accessibility, and localization.

Key Features

Core Architecture

  • 4 platforms, 1 ViewModel — shared TreeViewModel, services, and business logic across MAUI, Avalonia, WPF, and Blazor
  • Items within nodes — dual entity model (folders + items) in a single tree with independent selection, drag-drop, and context menus
  • Multiple hierarchies — host multiple independent trees in a single database, isolated by HierarchyName and SubsystemName
  • Auto-create on first load — hierarchies and root nodes are automatically created when referenced for the first time
  • ReadOnly modeTreeInteractionMode.ReadOnly disables editing, drag-drop, and context menus while keeping selection and expansion
  • 407 unit tests — comprehensive coverage across core, services, repositories, integration, and edge cases

Database & Persistence

  • Database-first — built-in EF Core persistence with 5 providers: SQLite, SQL Server, PostgreSQL, MySQL, Oracle
  • Auto-create tables — tables are created automatically on first use (or opt out for migration-based workflows)
  • Configurable table prefix — default tree_ prefix (e.g., tree_hierarchy, tree_node, tree_nodeitem), customizable or removable
  • Schema support — optional schema isolation for SQL Server, PostgreSQL, and Oracle
  • Audit fields — automatic CreatedAt, CreatedBy, ModifiedAt, ModifiedBy tracking on all entities (UTC, DOMAIN\Username format)
  • Custom user identity — provide a GetCurrentUser function for web apps or override the default OS user detection
  • Sort order management — automatic sort order assignment and reordering on drag-and-drop operations
  • Expand state persistence — expanded/collapsed state is tracked and restored across reloads

CRUD Operations

  • Built-in context menus — right-click menus with Add Folder, Add Root Folder, Add Item, Rename, Delete, Change Icon, Reset Icon
  • Customizable context menu labels — all menu text comes from ITreeStringProvider, fully localizable
  • Custom Add Item dialog — host applications implement OnAddItemRequestedAsync to provide their own UI for adding items with EntityType and EntityId
  • Customizable Add Item labelAddItemLabel property to change the context menu text (e.g., "Add Document", "Add Employee")
  • Validation hooksValidateNodeNameAsync and ValidateItemNameAsync for custom name validation rules
  • Confirmation hooksConfirmDeleteNodeAsync and ConfirmDeleteItemAsync for custom delete confirmation logic
  • Batch operationsAddItemRangeAsync, DeleteNodesAsync, DeleteItemsAsync for bulk operations
  • Fully customizable dialogsIDialogService interface with PromptAsync, ConfirmAsync, AlertAsync — override to use your own dialog system

Selection

  • Single selection — click to select a node or item, clears previous selection
  • Multi-selectionTreeSelectionMode.Multiple with Ctrl+Click toggle, Shift+Click range select
  • Select All — Ctrl+A selects all visible nodes and items (multi-selection mode)
  • Clear selection — programmatic ClearSelection() method
  • SelectionChanged event — fired with AddedNodes, RemovedNodes, AddedItems, RemovedItems collections
  • Allow/disallow node selectionAllowNodeSelection property to make the tree item-selection-only

Drag-and-Drop

  • Internal drag-and-drop — reorder nodes and items within the tree with visual drop indicators
  • External drop supportNodesAllowExternalDrop enables dropping external content onto tree nodes
  • Drag-drop toggleNodesAllowInternalDragDrop to enable/disable reordering independently of other editing
  • Drop zone indicators — colored indicators show valid (green) and invalid (red) drop targets
  • NodeDragOver / NodeDrop events — host applications can handle or cancel drops programmatically
  • Inline search barShowInternalSearchBar toggles a built-in search UI with match count display
  • Highlight mode — shows all nodes/items, visually emphasizes matches
  • Filter mode — hides non-matching nodes/items, showing only matches and their ancestor path
  • Search scopeSearchScope.NodeNames, ItemNames, or Both
  • Next/Previous navigation — step through matches with navigation buttons
  • SearchChanged event — fired when search text or results change
  • Programmatic search — bind SearchText and FilterMode properties directly

Checkboxes

  • Three-state checkboxes — Unchecked, Checked, Indeterminate (parent shows indeterminate when children are mixed)
  • Cascading checks — parent↔child cascading with CascadingChecks property
  • Checkbox scopeCheckboxScope.NodesOnly, ItemsOnly, or Both
  • Database persistencePersistCheckState saves check state to the database automatically
  • Check/Uncheck AllCheckAllAsync() and UncheckAllAsync() methods
  • GetCheckedNodes / GetCheckedItems — retrieve all currently checked entities
  • CheckedChanged event — fired when any checkbox state changes

Custom Node Icons

  • Per-node imagesNodeImage stored as byte[] in the database (varbinary/BLOB)
  • Built-in icon picker — enable with AllowCustomNodeIcons for a Change Icon / Reset Icon context menu
  • Custom icon dialog — implement OnCustomIconRequestedAsync in ITreeActions to provide your own icon picker
  • Default icon providerITreeIconProvider returns SVG path geometry for folder, item, and chevron icons — override for custom iconography

Theming

  • 4 built-in themes — Light, Dark, High Contrast (WCAG AAA), System (follows OS)
  • 15 color tokens — Background, Foreground, Hover, Selection, SelectionForeground, Accent, DropIndicator, DropTarget, InvalidDrop, SearchHighlight, SearchBarBackground, SearchBarBorder, FolderIcon, ItemIcon, CheckboxCheckedBackground
  • Per-theme customization — override individual tokens via LightThemeColors, DarkThemeColors, HighContrastThemeColors properties
  • WPF theme resourcesLightTheme.xaml, DarkTheme.xaml, HighContrastTheme.xaml resource dictionaries
  • Runtime theme switching — change theme at any time without reloading the tree

Accessibility

  • MAUISemanticProperties.Description, SemanticProperties.Hint, AutomationProperties.IsInAccessibleTree, AutomationId on every node and item
  • AvaloniaAutomationProperties integration
  • Blazor — 10+ ARIA attributes (role="tree", role="search", aria-label, aria-live, aria-atomic, aria-hidden, role="status", role="alert")
  • AutomationIds — unique TreeNode_{id} and TreeItem_{id} identifiers for UI testing

Keyboard Navigation

  • Arrow keys — Up/Down to move between rows, Left/Right to collapse/expand nodes
  • Home/End — jump to first/last visible row
  • Enter/Space — activate selected item or toggle node expansion
  • F2 — rename selected node or item
  • Delete — delete selected node or item (with confirmation)
  • Ctrl+A — select all (multi-selection mode)

Localization

  • 28 localizable strings — context menus, dialog titles, prompts, confirmations, search placeholder, buttons
  • ITreeStringProvider interface — implement for full localization, or subclass DefaultTreeStringProvider to override specific strings
  • 30 sample languages — including RTL languages (Arabic, Hebrew)
  • Runtime language switching — change StringProvider at any time without reloading
  • RTL supportIsRightToLeft property mirrors the entire control layout

Typography & Kiosk Mode

  • Font tokensTreeFontSize (default 14), TreeFontFamily, KioskFontScale (default 1.3×)
  • Kiosk modeKioskMode property enables touch-optimized display with larger hit targets and scaled fonts

Events & Host Integration

  • Node lifecycle eventsOnNodeExpandingAsync, OnNodeExpandedAsync, OnNodeCollapsingAsync, OnNodeCollapsedAsync, OnNodeSelectedAsync, OnNodeAddedAsync, OnNodeRenamedAsync, OnNodeDeletedAsync, OnNodeMovedAsync
  • Item lifecycle eventsOnItemSelectedAsync, OnItemActivatedAsync (double-click/tap), OnItemAddedAsync, OnItemRenamedAsync, OnItemDeletedAsync, OnItemMovedAsync
  • Control eventsSelectionChanged, SearchChanged, CheckedChanged, NodeDragOver, NodeDrop
  • ITreeActions interface — single implementation point for all host callbacks with DefaultTreeActions base class

Virtualization & Performance

  • MAUI — flat row list drives CollectionView with UI virtualization; only visible rows are rendered
  • Blazor — Blazor <Virtualize> component with configurable RowHeight and OverscanCount
  • Avalonia / WPF — flat row list with efficient expand/collapse updates
  • Expand state tracking — collapsed subtrees are excluded from the flat row list for minimal memory footprint

Programmatic API

  • NavigationExpandNode, CollapseNode, ExpandAll, CollapseAll, ScrollToNodeAsync, ScrollToItemAsync
  • CRUDAddNodeAsync, RenameNodeAsync, DeleteNodeAsync, MoveNodeAsync, AddItemAsync, RenameItemAsync, DeleteItemAsync, MoveItemAsync, AddItemRangeAsync, UpdateNodeImageAsync
  • Hierarchy managementCreateHierarchyAsync, UpdateHierarchyNameAsync, DeleteHierarchyAsync, GetHierarchiesBySubsystemAsync
  • StatsGetNodeCount(), GetItemCount()

Logging

  • ILogger integration — structured logging via Microsoft.Extensions.Logging
  • 4 severity levels — Debug, Information, Warning, Error with contextual properties
  • Exception capture — errors during CRUD operations are logged with full exception details

Solution Structure

HopDev.Tree.slnx
├── src/
│   ├── HopDev.Tree.Core                    Core models, enums, abstractions
│   ├── HopDev.Tree.UI                      Shared ViewModels, services, business logic
│   ├── HopDev.Tree.EntityFramework         EF Core repositories and unit of work
│   ├── HopDev.Tree.EntityFramework.*       Provider packages (Sqlite, SqlServer, PostgreSql, MySql, Oracle)
│   ├── HopDev.Tree.Maui                    .NET MAUI tree control
│   ├── HopDev.Tree.Avalonia               Avalonia tree control
│   ├── HopDev.Tree.Wpf                    WPF tree control
│   └── HopDev.Tree.Web                    Blazor tree control
├── samples/
│   ├── HopDev.Tree.Sample                  MAUI sample app
│   ├── HopDev.Tree.Avalonia.Sample        Avalonia sample app
│   └── HopDev.Tree.Wpf.Sample            WPF sample app
├── tests/
│   └── HopDev.Tree.Tests                  407 unit tests
└── docs/                                   Architecture, API, guides, ADRs, designs

Quick Start

MAUI

<ct:TreeControl x:Name="TreeControl"
                HierarchyName="MyApp"
                SubsystemName="Documents" />
TreeControl.Initialize(unitOfWork, actions);
await TreeControl.LoadAsync();

Avalonia

<tree:TreeControl x:Name="TreeControl" />
TreeControl.Initialize(unitOfWork, actions);
await TreeControl.LoadAsync();

WPF

<tree:TreeControl x:Name="TreeControl" />
TreeControl.Initialize(unitOfWork, actions);
await TreeControl.LoadAsync();

Blazor

<TreeControl HierarchyName="MyApp" SubsystemName="Documents"
             UnitOfWork="@unitOfWork" Actions="@actions" />

License

MIT

Product Compatible and additional computed target framework versions.
.NET 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 (9)

Showing the top 5 NuGet packages that depend on HopDev.Tree.EntityFramework:

Package Downloads
HopDev.Tree.Web

A Blazor hierarchical tree control with drag-and-drop, context menus, search, checkboxes, virtualization, and theming support. Built on HopDev.Tree.Core with Entity Framework integration.

HopDev.Tree.EntityFramework.PostgreSql

PostgreSQL database provider for HopDev.Tree hierarchical tree control. Includes sequence seeding (Hierarchy: 100+, Nodes/Items: 10000+), schema support, and optimized bytea storage.

HopDev.Tree.EntityFramework.Sqlite

SQLite database provider for HopDev.Tree hierarchical tree control. Ideal for local storage and single-user desktop applications.

HopDev.Tree.Avalonia

An Avalonia hierarchical tree control with drag-and-drop, context menus, search, checkboxes, and theming support. Built on HopDev.Tree.Core with Entity Framework integration.

HopDev.Tree.EntityFramework.MySql

MySQL database provider for HopDev.Tree hierarchical tree control. Uses MySql.EntityFrameworkCore. Includes auto-increment seeding (Hierarchy: 100+, Nodes/Items: 10000+) and optimized binary storage.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.1.0 43 3/26/2026
2.0.0 55 3/25/2026