New to Telerik UI for WinForms? Start a free 30-day trial

Builds and filters a suggestion drop-down for a RadDropDownListElement.

Definition

Namespace:Telerik.WinControls.UI

Assembly:Telerik.WinControls.UI.dll

Syntax:

C#
public class AutoCompleteSuggestHelper : BaseAutoComplete, IDisposable

Inheritance: objectBaseAutoCompleteAutoCompleteSuggestHelper

Implements: IDisposable

Inherited Members BaseAutoComplete.Owner

Constructors

Creates a suggestion list for the specified drop-down list and connects it to the owner's item and popup events.

C#
public AutoCompleteSuggestHelper(RadDropDownListElement owner)
Parameters:ownerRadDropDownListElement

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.

C#
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.

C#
public virtual string AutoCompleteDisplayMember { get; set; }

Gets or sets the member name that supplies each suggestion item's value from the autocomplete data source.

C#
public virtual string AutoCompleteValueMember { get; set; }

DropDownList Property

C#
public virtual RadDropDownListElement DropDownList { get; set; }

Gets the text currently used to filter the suggestion items.

C#
protected virtual string Filter { get; }

IsItemsDirty Property

C#
public virtual bool IsItemsDirty { get; }

Gets the string comparison used by the suggestion filter.

C#
protected virtual StringComparison StringComparison { get; }

Gets or sets whether suggestions match a prefix or any substring of the entered filter.

C#
public SuggestMode SuggestMode { get; set; }

Methods

Applies the filter to the suggestion list and orders matching items in ascending order.

C#
public virtual void ApplyFilterToDropDown(string filter)
Parameters:filterstring

The text used by the active suggestion filter.

Updates the suggestion filter from a key press, or closes the popup when Enter is pressed.

C#
public override void AutoComplete(KeyPressEventArgs e)
Parameters:eKeyPressEventArgs

The key press to process as autocomplete input.

Overrides: BaseAutoComplete.AutoComplete(KeyPressEventArgs)

Moves an index toward the requested direction until it reaches an enabled suggestion, or keeps the original index.

C#
protected virtual int ClampSelectedIndex(bool down, int selectedIndex, int itemsCount)
Parameters:downbool

true to move toward higher indexes; otherwise, move toward lower indexes.

selectedIndexint

The starting suggestion index.

itemsCountint

The number of suggestions available for navigation.

Returns:

int

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.

C#
public virtual void CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
Parameters:senderobject

The collection that changed.

eNotifyCollectionChangedEventArgs

Details about the collection change.

Creates the drop-down element that hosts autocomplete suggestions.

C#
protected virtual RadDropDownListElement CreateDropDownElement()
Returns:

RadDropDownListElement

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.

C#
protected virtual bool DefaultFilter(RadListDataItem item)
Parameters:itemRadListDataItem

The suggestion item to test.

Returns:

bool

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.

C#
public override void Dispose()

Overrides: BaseAutoComplete.Dispose()

Applies a filter and opens the popup only for a nonempty filter with results other than a single exact match.

C#
public virtual void HandleAutoSuggest(string filter)
Parameters:filterstring

The text used to filter suggestion items.

Selects the next or previous enabled item in the suggestion list.

C#
public virtual void HandleSelectNextOrPrev(bool next)
Parameters:nextbool

true to advance; otherwise, move to the previous item.

Selects the owner's editable text when the suggestion popup is closed with the keyboard.

C#
public virtual void PopupClosed(object sender, RadPopupClosedEventArgs args)
Parameters:senderobject

The object that raised the popup-closed notification.

argsRadPopupClosedEventArgs

The 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.

C#
protected virtual void SelectedIndexChanged(object sender, PositionChangedEventArgs e)
Parameters:senderobject

The suggestion list that raised the selection change.

ePositionChangedEventArgs

The new selection position.

Builds the next filter text by inserting the key character at the editor selection or appending it.

C#
public virtual string SetFindString(KeyPressEventArgs e)
Parameters:eKeyPressEventArgs

The key press whose character is added to the filter.

Returns:

string

The filter text after applying the key press.

Builds the filter text that remains after processing Backspace, accounting for any selected editor text.

C#
public virtual string SetFindStringFromBack()
Returns:

string

The text preceding the removed character or selection.

Opens the suggestion popup while preserving the owner's current text selection.

C#
public virtual void ShowDropDownList()

Refreshes the suggestion list from the owner's items when the cached copy is marked dirty.

C#
protected virtual void SyncItems()

Rebuilds the suggestion list from the owner's items, preserving values and locally set enabled and text-wrap settings.

C#
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.

C#
protected virtual void SyncOwnerElementWithSelectedIndex()