Search Results for

Show / Hide Table of Contents

# Interface ITreeBuilder<T>

Interface for supplying data to a TreeView<T> on demand as root level nodes are expanded by the user

###### Namespace: Terminal.Gui.Trees

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

##### Syntax

    public interface ITreeBuilder<T>

##### Type Parameters

Name | Description
--- | ---
T |

### Properties

#### SupportsCanExpand

Returns true if CanExpand(T) is implemented by this class

##### Declaration

    bool SupportsCanExpand { get; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

### Methods

#### CanExpand(T)

Returns true/false for whether a model has children. This method should be implemented when GetChildren(T) is an expensive operation otherwise SupportsCanExpand should return false (in which case this method will not be called)

##### Declaration

    bool CanExpand(T toExpand)

##### Parameters

Type | Name | Description
--- | --- | ---
T | toExpand |

##### Returns

Type | Description
--- | ---
System.Boolean |

##### Remarks

Only implement this method if you have a very fast way of determining whether an object can have children e.g. checking a Type (directories can always be expanded)

#### GetChildren(T)

Returns all children of a given `forObject` which should be added to the tree as new branches underneath it

##### Declaration

    IEnumerable<T> GetChildren(T forObject)

##### Parameters

Type | Name | Description
--- | --- | ---
T | forObject |

##### Returns

Type | Description
--- | ---
System.Collections.Generic.IEnumerable<T> |