Table of Contents

Class NavigationItem

Namespace
SharpConsoleUI.Controls
Assembly
SharpConsoleUI.dll

Represents a single item in a NavigationView control.

public class NavigationItem
Inheritance
NavigationItem
Inherited Members
Extension Methods

Constructors

NavigationItem(string, string?, string?)

Initializes a new instance of the NavigationItem class.

public NavigationItem(string text, string? icon = null, string? subtitle = null)

Parameters

text string

The display text.

icon string

Optional icon prefix.

subtitle string

Optional subtitle for the content header.

Properties

HeaderColor

Gets or sets an optional color for header items.

public Color? HeaderColor { get; set; }

Property Value

Color?

Icon

Gets or sets an optional icon (emoji/symbol) prefix shown before the text.

public string? Icon { get; set; }

Property Value

string

IsEnabled

Gets or sets whether this item is enabled and can be selected.

public bool IsEnabled { get; set; }

Property Value

bool

IsExpanded

Gets or sets whether a header's children are visible. Only meaningful for items with ItemType == Header.

public bool IsExpanded { get; set; }

Property Value

bool

ItemType

Gets the type of this navigation item (Item, Header, or Separator).

public NavigationItemType ItemType { get; }

Property Value

NavigationItemType

ParentHeader

Gets the parent header for sub-items, or null for top-level items.

public NavigationItem? ParentHeader { get; }

Property Value

NavigationItem

Subtitle

Gets or sets an optional subtitle shown in the content header when this item is selected.

public string? Subtitle { get; set; }

Property Value

string

Tag

Gets or sets custom metadata associated with this item.

public object? Tag { get; set; }

Property Value

object

Text

Gets or sets the display text for this navigation item.

public string Text { get; set; }

Property Value

string

Methods

CreateHeader(string, Color?)

Creates a header item that groups child items.

public static NavigationItem CreateHeader(string text, Color? color = null)

Parameters

text string
color Color?

Returns

NavigationItem

CreateSeparator()

Creates a separator item (visual divider).

public static NavigationItem CreateSeparator()

Returns

NavigationItem

Operators

implicit operator NavigationItem(string)

Implicit conversion from string to NavigationItem.

public static implicit operator NavigationItem(string text)

Parameters

text string

Returns

NavigationItem