Class UserListSource
Custom list data source for the online users panel with per-user nickname colors.
public class UserListSource : IListDataSource, IDisposable
- Inheritance
-
UserListSource
- Implements
- Inherited Members
Constructors
UserListSource()
public UserListSource()
Properties
Count
Gets the number of items in the data source.
public int Count { get; }
Property Value
MaxItemLength
Gets the width in columns of the widest item in the data source.
public int MaxItemLength { get; }
Property Value
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
Remarks
Set to true to prevent CollectionChanged from being raised during bulk operations. Set back to false to resume event notifications.
Methods
Dispose()
public void Dispose()
IsMarked(int)
Determines whether the specified item is marked.
public bool IsMarked(int item)
Parameters
itemintThe zero-based index of the item.
Returns
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
listViewListViewThe ListView to render to.
selectedboolitemintThe zero-based index of the item to render.
colintThe column in
listViewViewport where rendering starts.rowintThe row in
listViewViewport where rendering starts.widthintThe width available for rendering.
viewportXintThe 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
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.
Update(List<(string Text, Attribute? NameColor)>)
public void Update(List<(string Text, Attribute? NameColor)> users)
Parameters
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.