Search Results for

    Show / Hide Table of Contents

    Class CollectionNavigator

    Navigates a collection of items using keystrokes. The keystrokes are used to build a search string. The SearchString is used to find the next item in the collection that matches the search string when GetNextMatchingItem(int, char) is called.

    If the user types keystrokes that can't be found in the collection, the search string is cleared and the next item is found that starts with the last keystroke.

    If the user pauses keystrokes for a short time (see TypingDelay), the search string is cleared.

    Inheritance
    object
    CollectionNavigator
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Terminal.Gui
    Assembly: Terminal.Gui.dll
    Syntax
    public class CollectionNavigator

    Constructors

    | Edit this page View Source

    CollectionNavigator()

    Constructs a new CollectionNavigator.
    Declaration
    public CollectionNavigator()
    | Edit this page View Source

    CollectionNavigator(IEnumerable<object>)

    Constructs a new CollectionNavigator for the given collection.
    Declaration
    public CollectionNavigator(IEnumerable<object> collection)
    Parameters
    Type Name Description
    IEnumerable<object> collection

    Properties

    | Edit this page View Source

    Collection

    The collection of objects to search. ToString() is used to search the collection.
    Declaration
    public IEnumerable<object> Collection { get; set; }
    Property Value
    Type Description
    IEnumerable<object>
    | Edit this page View Source

    Comparer

    The compararer function to use when searching the collection.
    Declaration
    public StringComparer Comparer { get; set; }
    Property Value
    Type Description
    StringComparer
    | Edit this page View Source

    SearchString

    Gets the current search string. This includes the set of keystrokes that have been pressed since the last unsuccessful match or after TypingDelay) milliseconds. Useful for debugging.
    Declaration
    public string SearchString { get; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    TypingDelay

    Gets or sets the number of milliseconds to delay before clearing the search string. The delay is reset on each call to GetNextMatchingItem(int, char). The default is 500ms.
    Declaration
    public int TypingDelay { get; set; }
    Property Value
    Type Description
    int

    Methods

    | Edit this page View Source

    GetNextMatchingItem(int, char)

    Gets the index of the next item in the collection that matches the current SearchString plus the provided character (typically from a key press).
    Declaration
    public int GetNextMatchingItem(int currentIndex, char keyStruck)
    Parameters
    Type Name Description
    int currentIndex The index in the collection to start the search from.
    char keyStruck The character of the key the user pressed.
    Returns
    Type Description
    int The index of the item that matches what the user has typed. Returns -1 if no item in the collection matched.
    | Edit this page View Source

    IsCompatibleKey(KeyEvent)

    Returns true if kb is a searchable key (e.g. letters, numbers etc) that is valid to pass to to this class for search filtering.
    Declaration
    public static bool IsCompatibleKey(KeyEvent kb)
    Parameters
    Type Name Description
    KeyEvent kb
    Returns
    Type Description
    bool
    | Edit this page View Source

    OnSearchStringChanged(KeystrokeNavigatorEventArgs)

    Invoked when the SearchString changes. Useful for debugging. Invokes the SearchStringChanged event.
    Declaration
    public virtual void OnSearchStringChanged(CollectionNavigator.KeystrokeNavigatorEventArgs e)
    Parameters
    Type Name Description
    CollectionNavigator.KeystrokeNavigatorEventArgs e

    Events

    | Edit this page View Source

    SearchStringChanged

    This event is invoked when SearchString changes. Useful for debugging.
    Declaration
    public event Action<CollectionNavigator.KeystrokeNavigatorEventArgs> SearchStringChanged
    Event Type
    Type Description
    Action<CollectionNavigator.KeystrokeNavigatorEventArgs>
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX