Class ImGuiList<T>
Wraps a collection of objects for ImGui controls, like list boxes.
Inherited Members
Namespace: SadConsole.ImGuiSystem
Assembly: SadConsole.Debug.MonoGame.dll
Syntax
public class ImGuiList<T> where T : class
Type Parameters
| Name | Description |
|---|---|
| T | The type of object wrapped. |
Constructors
ImGuiList(IEnumerable<T>)
Creates a new list, wrapping the provided items.
Declaration
public ImGuiList(IEnumerable<T> items)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<T> | items | The items to wrap. |
ImGuiList(int, IEnumerable<T>)
Creates a new list, wrapping the provided items, and sets which item is selected.
Declaration
public ImGuiList(int selectedIndex, IEnumerable<T> items)
Parameters
| Type | Name | Description |
|---|---|---|
| int | selectedIndex | The 0-based index of the item to select. |
| IEnumerable<T> | items | The items to wrap. |
ImGuiList(int, params T[])
Creates a new list, wrapping the provided items, and sets which item is selected.
Declaration
public ImGuiList(int selectedIndex, params T[] items)
Parameters
| Type | Name | Description |
|---|---|---|
| int | selectedIndex | The 0-based index of the item to select. |
| T[] | items | The items to wrap. |
ImGuiList(params T[])
Creates a new list, wrapping the provided items.
Declaration
public ImGuiList(params T[] items)
Parameters
| Type | Name | Description |
|---|---|---|
| T[] | items | The items to wrap. |
Fields
SelectedItemIndex
The selected index. Controlled by ImGui objects.
Declaration
public int SelectedItemIndex
Field Value
| Type | Description |
|---|---|
| int |
Properties
Count
The number of items this list is wrapping.
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| int |
Names
Each item's title.
Declaration
public string[] Names { get; }
Property Value
| Type | Description |
|---|---|
| string[] |
Remarks
Refreshed when this property is accessed.
Objects
The objects wrapped by this list.
Declaration
public ObservableCollection<T> Objects { get; }
Property Value
| Type | Description |
|---|---|
| ObservableCollection<T> |
SelectedItem
The selected item or null.
Declaration
public T? SelectedItem { get; set; }
Property Value
| Type | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Thrown when the property is set to a value that doesn't exist in the collection. |
Methods
IsItemSelected()
Indicates that an item is selected.
Declaration
public bool IsItemSelected()
Returns
| Type | Description |
|---|---|
| bool | Checks if SelectedItemIndex doesn't equal -1. |