Table of Contents

Class ChatListSource

Namespace
EchoHub.Client.UI.Chat
Assembly
EchoHub.Client.dll

Custom list data source for chat messages with per-segment coloring.

public class ChatListSource : IListDataSource, IDisposable
Inheritance
ChatListSource
Implements
Inherited Members

Constructors

ChatListSource()

public ChatListSource()

Properties

Count

Gets the number of items in the data source.

public int Count { get; }

Property Value

int

MaxItemLength

Gets the width in columns of the widest item in the data source.

public int MaxItemLength { get; }

Property Value

int

Remarks

ListView uses this value to set its horizontal content size for scrolling.

SuspendCollectionChangedEvent

Gets or sets whether the CollectionChanged event should be suppressed.

public bool SuspendCollectionChangedEvent { get; set; }

Property Value

bool

Remarks

Set to true to prevent CollectionChanged from being raised during bulk operations. Set back to false to resume event notifications.

Methods

Add(ChatLine)

public void Add(ChatLine line)

Parameters

line ChatLine

AddRange(IEnumerable<ChatLine>)

public void AddRange(IEnumerable<ChatLine> lines)

Parameters

lines IEnumerable<ChatLine>

Clear()

public void Clear()

Dispose()

public void Dispose()

GetLine(int)

public ChatLine? GetLine(int index)

Parameters

index int

Returns

ChatLine

InsertRange(int, IEnumerable<ChatLine>)

public void InsertRange(int index, IEnumerable<ChatLine> lines)

Parameters

index int
lines IEnumerable<ChatLine>

IsMarked(int)

Determines whether the specified item is marked.

public bool IsMarked(int item)

Parameters

item int

The zero-based index of the item.

Returns

bool

true if the item is marked; otherwise false.

Remarks

ListView calls this method to determine whether to render the item with a mark indicator when ShowMarks is true.

Render(ListView, bool, int, int, int, int, int)

Renders the specified item to the ListView.

public void Render(ListView listView, bool selected, int item, int col, int row, int width, int viewportX = 0)

Parameters

listView ListView

The ListView to render to.

selected bool

true if the item is currently selected; otherwise false.

item int

The zero-based index of the item to render.

col int

The column in listView Viewport where rendering starts.

row int

The row in listView Viewport where rendering starts.

width int

The width available for rendering.

viewportX int

The horizontal scroll offset.

Remarks

ListView calls this method for each visible item during rendering. The color scheme will be set based on selection state before this method is called.

Implementations must fill the entire width to avoid rendering artifacts.

SetMark(int, bool)

Sets the marked state of the specified item.

public void SetMark(int item, bool value)

Parameters

item int

The zero-based index of the item.

value bool

true to mark the item; false to unmark it.

Remarks

ListView calls this method when the user toggles marking (e.g., via the SPACE key) if ShowMarks is true.

ToList()

Returns the underlying data source as an System.Collections.IList.

public IList ToList()

Returns

IList

The data source as an System.Collections.IList.

Remarks

ListView uses this method to access individual items for events like ValueChanged and to enable keyboard search via KeystrokeNavigator.

Events

CollectionChanged

Raised when items are added, removed, moved, or the entire collection is refreshed.

public event NotifyCollectionChangedEventHandler? CollectionChanged

Event Type

NotifyCollectionChangedEventHandler

Remarks

ListView subscribes to this event to update its display and content size when the data changes. Implementations should raise this event whenever the underlying collection changes, unless SuspendCollectionChangedEvent is true.