Table of Contents

Class FilteredTreeView<T>

Namespace
NanoByte.Common.Controls
Assembly
NanoByte.Common.WinForms.dll

Displays a list of INameds objects in a TreeView with incremental search. An automatic hierarchy is generated based on a Separator character.

[Guid("5065F310-D0B3-4AD3-BBE5-B41D00D5F036")]
public sealed class FilteredTreeView<T> : UserControl where T : notnull, INamed

Type Parameters

T

The type of INamed object to list. Special support for types implementing IHighlightColor and/or IContextMenu.

Inheritance
FilteredTreeView<T>
Extension Methods

Constructors

FilteredTreeView()

public FilteredTreeView()

Properties

CheckBoxes

Controls whether check boxes are displayed for every entry.

public bool CheckBoxes { get; set; }

Property Value

bool

CheckedEntries

Returns a list of all INamed objects currently marked with a check box.

public ICollection<T> CheckedEntries { get; }

Property Value

ICollection<T>

Remarks

Does NOT create a defensive copy. Take care to only add valid elements when modifying. Call UpdateList(object?) after changing.

Nodes

The INamed (and optionally IContextMenu) objects to be listed in the tree.

[Browsable(false)]
public NamedCollection<T>? Nodes { get; set; }

Property Value

NamedCollection<T>

SelectedEntry

The INamed object currently selected in the TreeView; null for no selection.

[Browsable(false)]
public T? SelectedEntry { get; set; }

Property Value

T

Separator

The character used to split Names into tree levels.

public char Separator { get; set; }

Property Value

char

ShowSearchBox

Toggle the visibility of the search box.

public bool ShowSearchBox { get; set; }

Property Value

bool

Methods

Dispose(bool)

Clean up any resources being used.

protected override void Dispose(bool disposing)

Parameters

disposing bool

true if managed resources should be disposed; otherwise, false.

UpdateList(object?)

Updates the filtered TreeView representation of Nodes.

public void UpdateList(object? sender = null)

Parameters

sender object

Remarks

Called automatically internally.

Events

CheckedEntriesChanged

Occurs whenever the content of CheckedEntries has changed.

public event EventHandler? CheckedEntriesChanged

Event Type

EventHandler

SelectedEntryChanged

Occurs whenever SelectedEntry has been changed.

public event EventHandler? SelectedEntryChanged

Event Type

EventHandler

SelectionConfirmed

Occurs when the user has confirmed the SelectedEntry via double-clicking or pressing Enter.

public event EventHandler? SelectionConfirmed

Event Type

EventHandler