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.
public class CollectionNavigator
- Inheritance
-
CollectionNavigator
- Inherited Members
Constructors
- CollectionNavigator()
Constructs a new CollectionNavigator.
- CollectionNavigator(IEnumerable<object>)
Constructs a new CollectionNavigator for the given collection.
Properties
- Collection
The collection of objects to search. ToString() is used to search the collection.
- Comparer
The compararer function to use when searching the collection.
- 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.
- 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.
Methods
- 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).
- 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.
- OnSearchStringChanged(KeystrokeNavigatorEventArgs)
Invoked when the SearchString changes. Useful for debugging. Invokes the SearchStringChanged event.
Events
- SearchStringChanged
This event is invoked when SearchString changes. Useful for debugging.