Show / Hide Table of Contents

# Interface IListDataSource

Implement IListDataSource to provide custom rendering for a ListView.

###### Namespace: Terminal.Gui

###### Assembly: Terminal.Gui.dll

##### Syntax

    public interface IListDataSource

### Properties

#### Count

Returns the number of elements to display

##### Declaration

    int Count { get; }

##### Property Value

Type | Description
--- | ---
System.Int32 |

### Methods

#### IsMarked(Int32)

Should return whether the specified item is currently marked.

##### Declaration

    bool IsMarked(int item)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Int32 | item | Item index.

##### Returns

Type | Description
--- | ---
System.Boolean | `true`, if marked, `false` otherwise.

#### Render(ListView, ConsoleDriver, Boolean, Int32, Int32, Int32, Int32)

This method is invoked to render a specified item, the method should cover the entire provided width.

##### Declaration

    void Render(ListView container, ConsoleDriver driver, bool selected, int item, int col, int line, int width)

##### Parameters

Type | Name | Description
--- | --- | ---
ListView | container | The list view to render.
ConsoleDriver | driver | The console driver to render.
System.Boolean | selected | Describes whether the item being rendered is currently selected by the user.
System.Int32 | item | The index of the item to render, zero for the first item and so on.
System.Int32 | col | The column where the rendering will start
System.Int32 | line | The line where the rendering will be done.
System.Int32 | width | The width that must be filled out.

##### Remarks

The default color will be set before this method is invoked, and will be based on whether the item is selected or not.

#### SetMark(Int32, Boolean)

Flags the item as marked.

##### Declaration

    void SetMark(int item, bool value)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Int32 | item | Item index.
System.Boolean | value | If set to `true` value.

#### ToList()

Return the source as IList.

##### Declaration

    IList ToList()

##### Returns

Type | Description
--- | ---
System.Collections.IList |