Builds and filters a suggestion drop-down for a RadDropDownListElement.
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.UI.dll
Syntax:
public class AutoCompleteSuggestHelper : BaseAutoComplete, IDisposable
Inheritance: objectBaseAutoCompleteAutoCompleteSuggestHelper
Implements:
Inherited Members
Constructors
Creates a suggestion list for the specified drop-down list and connects it to the owner's item and popup events.
public AutoCompleteSuggestHelper(RadDropDownListElement owner)
The drop-down list element whose items and editable text drive suggestions.
Properties
Gets or sets the object that is responsible for providing data objects for the AutoComplete Suggest.
public virtual object AutoCompleteDataSource { get; set; }
Gets or sets the member name that supplies the text displayed for each suggestion from the autocomplete data source.
public virtual string AutoCompleteDisplayMember { get; set; }
Gets or sets the member name that supplies each suggestion item's value from the autocomplete data source.
public virtual string AutoCompleteValueMember { get; set; }
DropDownList Property
public virtual RadDropDownListElement DropDownList { get; set; }
Gets the text currently used to filter the suggestion items.
protected virtual string Filter { get; }
IsItemsDirty Property
public virtual bool IsItemsDirty { get; }
Gets the string comparison used by the suggestion filter.
protected virtual StringComparison StringComparison { get; }
Gets or sets whether suggestions match a prefix or any substring of the entered filter.
public SuggestMode SuggestMode { get; set; }
Methods
Applies the filter to the suggestion list and orders matching items in ascending order.
public virtual void ApplyFilterToDropDown(string filter)
The text used by the active suggestion filter.
Updates the suggestion filter from a key press, or closes the popup when Enter is pressed.
public override void AutoComplete(KeyPressEventArgs e)
The key press to process as autocomplete input.
Overrides:
Moves an index toward the requested direction until it reaches an enabled suggestion, or keeps the original index.
protected virtual int ClampSelectedIndex(bool down, int selectedIndex, int itemsCount)
true to move toward higher indexes; otherwise, move toward lower indexes.
selectedIndexintThe starting suggestion index.
itemsCountintThe number of suggestions available for navigation.
Returns:The next enabled index, or selectedIndex if none is available in that direction.
Marks copied suggestions dirty after the owner's item collection changes when suggestions are not data-bound.
public virtual void CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
The collection that changed.
eNotifyCollectionChangedEventArgsDetails about the collection change.
Creates the drop-down element that hosts autocomplete suggestions.
protected virtual RadDropDownListElement CreateDropDownElement()
The suggestion drop-down element to attach to the owner.
Tests an item's text against the current filter using the configured suggestion mode and string comparison.
protected virtual bool DefaultFilter(RadListDataItem item)
The suggestion item to test.
Returns:true when the item matches the active filter; otherwise, false.
Detaches collection and popup event handlers and removes the suggestion drop-down from the owner.
public override void Dispose()
Overrides:
Applies a filter and opens the popup only for a nonempty filter with results other than a single exact match.
public virtual void HandleAutoSuggest(string filter)
The text used to filter suggestion items.
Selects the owner's editable text when the suggestion popup is closed with the keyboard.
public virtual void PopupClosed(object sender, RadPopupClosedEventArgs args)
The object that raised the popup-closed notification.
argsRadPopupClosedEventArgsThe popup close reason used to determine whether to select the editor text.
Synchronizes a selected suggestion with the owner unless a data update is in progress.
protected virtual void SelectedIndexChanged(object sender, PositionChangedEventArgs e)
The suggestion list that raised the selection change.
ePositionChangedEventArgsThe new selection position.
Builds the next filter text by inserting the key character at the editor selection or appending it.
public virtual string SetFindString(KeyPressEventArgs e)
The key press whose character is added to the filter.
Returns:The filter text after applying the key press.
Builds the filter text that remains after processing Backspace, accounting for any selected editor text.
public virtual string SetFindStringFromBack()
The text preceding the removed character or selection.
Opens the suggestion popup while preserving the owner's current text selection.
public virtual void ShowDropDownList()
Refreshes the suggestion list from the owner's items when the cached copy is marked dirty.
protected virtual void SyncItems()
Rebuilds the suggestion list from the owner's items, preserving values and locally set enabled and text-wrap settings.
protected virtual void SyncItemsCore()
Applies the selected suggestion to the owner by matching its text and value, or copies its text if no owner item matches.
protected virtual void SyncOwnerElementWithSelectedIndex()