ClassRadAutoCompleteBox
Represents a customizable auto-completion box control that allows users to select from a filtered list of suggestions based on their input. The RadAutoCompleteBox supports single and multiple selection modes, provides features like watermark content, dropdown item templates, and various behaviors for filtering and highlighting items. It uses dependency properties to manage its state and appearance, including search text, selected items, and dropdown properties. This control includes built-in keyboard navigation and event handling for selection changes, making it suitable for enhancing user input experiences in applications.
Definition
Namespace:Telerik.Windows.Controls
Assembly:Telerik.Windows.Controls.Input.dll
Syntax:
[TelerikToolboxCategory("Input")]
[SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly")]
[Themable]
public class RadAutoCompleteBox : Control, IDisposable
Inheritance: objectRadAutoCompleteBox
Implements:
Constructors
RadAutoCompleteBox()
Initializes a new instance of the RadAutoCompleteBox class.
Declaration
public RadAutoCompleteBox()
Fields
AutoCompleteModeProperty
Identifies the AutoCompleteMode dependency property.
Declaration
public static readonly DependencyProperty AutoCompleteModeProperty
Field Value
DependencyProperty
BoxesItemStyleProperty
Identifies the BoxesItemStyle dependency property.
Declaration
public static readonly DependencyProperty BoxesItemStyleProperty
Field Value
DependencyProperty
BoxesItemStyleSelectorProperty
Identifies the BoxesItemStyleSelector dependency property.
Declaration
public static readonly DependencyProperty BoxesItemStyleSelectorProperty
Field Value
DependencyProperty
BoxesItemTemplateProperty
Identifies the BoxesItemTemplate dependency property.
Declaration
public static readonly DependencyProperty BoxesItemTemplateProperty
Field Value
DependencyProperty
BoxesItemTemplateSelectorProperty
Identifies the BoxesItemTemplateSelector dependency property.
Declaration
public static readonly DependencyProperty BoxesItemTemplateSelectorProperty
Field Value
DependencyProperty
DisplayMemberPathProperty
Identifies the DisplayMemberPath dependency property.
Declaration
public static readonly DependencyProperty DisplayMemberPathProperty
Field Value
DependencyProperty
DropDownItemTemplateProperty
Identifies the DropDownItemTemplate dependency property.
Declaration
public static readonly DependencyProperty DropDownItemTemplateProperty
Field Value
DependencyProperty
DropDownItemTemplateSelectorProperty
Identifies the DropDownItemTemplateSelector dependency property.
Declaration
public static readonly DependencyProperty DropDownItemTemplateSelectorProperty
Field Value
DependencyProperty
DropDownPlacementProperty
Identifies the DropDownPlacement dependency property.
Declaration
public static readonly DependencyProperty DropDownPlacementProperty
Field Value
DependencyProperty
DropDownWidthProperty
Identifies the DropDownWidth dependency property.
Declaration
public static readonly DependencyProperty DropDownWidthProperty
Field Value
DependencyProperty
FilteredItemsProperty
Identifies the MaxDropDownWidthProperty dependency property.
Declaration
public static readonly DependencyProperty FilteredItemsProperty
Field Value
DependencyProperty
FilteringBehaviorProperty
Identifies the FilteringBehavior dependency property.
Declaration
public static readonly DependencyProperty FilteringBehaviorProperty
Field Value
DependencyProperty
HighlightBehaviorProperty
Identifies the HighlightBehavior dependency property.
Declaration
public static readonly DependencyProperty HighlightBehaviorProperty
Field Value
DependencyProperty
IsDropDownOpenProperty
Identifies the IsDropDownOpen dependency property.
Declaration
public static readonly DependencyProperty IsDropDownOpenProperty
Field Value
DependencyProperty
IsHighlightedProperty
Identifies the IsHighlighted dependency property.
Declaration
public static readonly DependencyProperty IsHighlightedProperty
Field Value
DependencyProperty
ItemsSourceProperty
Identifies the ItemsSource dependency property.
Declaration
public static readonly DependencyProperty ItemsSourceProperty
Field Value
DependencyProperty
MaxDropDownHeightProperty
Identifies the MaxDropDownHeight dependency property.
Declaration
public static readonly DependencyProperty MaxDropDownHeightProperty
Field Value
DependencyProperty
MaxDropDownWidthProperty
Identifies the MaxDropDownWidthProperty dependency property.
Declaration
public static readonly DependencyProperty MaxDropDownWidthProperty
Field Value
DependencyProperty
MinDropDownWidthProperty
Identifies the MinDropDownWidthProperty dependency property.
Declaration
public static readonly DependencyProperty MinDropDownWidthProperty
Field Value
DependencyProperty
NoResultsContentProperty
Identifies the NoResultsContent dependency property.
Declaration
public static readonly DependencyProperty NoResultsContentProperty
Field Value
DependencyProperty
NoResultsContentTemplateProperty
Identifies the NoResultsContentTemplate dependency property.
Declaration
public static readonly DependencyProperty NoResultsContentTemplateProperty
Field Value
DependencyProperty
SearchTextProperty
Identifies the MaxDropDownWidthProperty dependency property.
Declaration
public static readonly DependencyProperty SearchTextProperty
Field Value
DependencyProperty
SelectedItemProperty
Identifies the SelectedItem dependency property.
Declaration
public static readonly DependencyProperty SelectedItemProperty
Field Value
DependencyProperty
SelectedItemsProperty
Identifies the SelectedItems dependency property.
Declaration
public static readonly DependencyProperty SelectedItemsProperty
Field Value
DependencyProperty
SelectionChangedEvent
Occurs when the selection of a RadAutoCompleteBox changes.
Declaration
public static readonly RoutedEvent SelectionChangedEvent
Field Value
RoutedEvent
SelectionModeProperty
Identifies the SelectionMode dependency property.
Declaration
public static readonly DependencyProperty SelectionModeProperty
Field Value
DependencyProperty
TextBoxStyleProperty
Identifies the TextBoxStyle dependency property.
Declaration
public static readonly DependencyProperty TextBoxStyleProperty
Field Value
DependencyProperty
TextSearchModeProperty
Identifies the TextSearchMode dependency property.
Declaration
public static readonly DependencyProperty TextSearchModeProperty
Field Value
DependencyProperty
TextSearchPathProperty
Identifies the TextSearchPath dependency property.
Declaration
public static readonly DependencyProperty TextSearchPathProperty
Field Value
DependencyProperty
WatermarkContentProperty
Identifies the WatermarkContent dependency property.
Declaration
public static readonly DependencyProperty WatermarkContentProperty
Field Value
DependencyProperty
Properties
AutoCompleteMode
Specifies the autocomplete mode for the RadAutoCompleteBox. This is a dependency property.
Declaration
public AutoCompleteMode AutoCompleteMode { get; set; }
Property Value
BoxesItemStyle
Gets or sets the System.Windows.Style used to display each item into the boxes part of the control. This is a dependency property.
Declaration
public Style BoxesItemStyle { get; set; }
Property Value
Style
BoxesItemStyleSelector
Gets or sets the System.Windows.Controls.StyleSelector used to choose System.Windows.Style to display each item into the boxes part of the control. This is a dependency property.
Declaration
public StyleSelector BoxesItemStyleSelector { get; set; }
Property Value
StyleSelector
BoxesItemTemplate
Gets or sets the System.Windows.DataTemplate used to display each item into the boxes part of the control. This is a dependency property.
Declaration
public DataTemplate BoxesItemTemplate { get; set; }
Property Value
DataTemplate
BoxesItemTemplateSelector
Gets or sets the System.Windows.Controls.DataTemplateSelector used to choose System.Windows.DataTemplate to display each item into the boxes part of the control. This is a dependency property.
Declaration
public DataTemplateSelector BoxesItemTemplateSelector { get; set; }
Property Value
DataTemplateSelector
DisplayMemberPath
The name or path of the property that is displayed for each the data item in the control. The default is an empty string (""). This is a dependency property.
DropDownItemTemplate
Gets or sets the System.Windows.DataTemplate used to display each item into the DropDown part of the control. This is a dependency property.
Declaration
public DataTemplate DropDownItemTemplate { get; set; }
Property Value
DataTemplate
DropDownItemTemplateSelector
Gets or sets the System.Windows.Controls.DataTemplateSelector used to choose System.Windows.DataTemplate to display each DropDown item into the dropdown part of the control. This is a dependency property.
Declaration
public DataTemplateSelector DropDownItemTemplateSelector { get; set; }
Property Value
DataTemplateSelector
DropDownPlacement
Gets or sets value indicating where the DropDown part of the control will be placed. This is a dependency property.
Declaration
public AutoCompleteDropDownPlacement DropDownPlacement { get; set; }
Property Value
DropDownWidth
Gets or sets a GridLength that indicates what the RadAutoCompleteBox' DropDown width will be.
Declaration
public GridLength DropDownWidth { get; set; }
Property Value
GridLength
FilteredItems
Gets the currently filtered items into the RadAutoCompleteBox. This is a dependency property.
FilteringBehavior
Gets or sets the FilteringBehavior of the RadAutoCompleteBox. This is a dependency property.
Declaration
public IFilteringBehavior FilteringBehavior { get; set; }
Property Value
HighlightBehavior
Gets or sets the HighlightBehavior of the RadAutoCompleteBox. This is a dependency property.
Declaration
public IHighlightBehavior HighlightBehavior { get; set; }
Property Value
HighlightedIndex
Gets or sets the currently highlighted index in the dropdown portion of the control.
IsDropDownOpen
Gets or sets the value that indicates whether the RadAutoCompleteBox dropdown is currently open. This is a dependency property.
IsHighlighted
Gets or sets a value indicating whether this instance is highlighted. This is a dependency property.
ItemsSource
Gets or sets a collection that is filtered when the user enters text. This is a dependency property.
Declaration
public IEnumerable ItemsSource { get; set; }
Property Value
MaxDropDownHeight
Gets or sets the maximum height for a RadAutoCompleteBox drop-down. This is a dependency property.
MaxDropDownWidth
Gets or sets the maximum width of a RadAutoCompleteBox drop-down. This is a dependency property.
MinDropDownWidth
Gets or sets the minimum width of a RadAutoCompleteBox drop-down. This is a dependency property.
NoResultsContent
Gets or sets the content displayed in the dropdown if the filter result is empty.
NoResultsContentTemplate
Gets or sets the System.Windows.DataTemplate used to display the content in the dropdown if the filter result is empty.
Declaration
public DataTemplate NoResultsContentTemplate { get; set; }
Property Value
DataTemplate
SearchText
Gets or sets the string that is into the TextBox part of the RadAutoCompleteBox. The SearchText value is used to filter the RadAutoCompleteBox' ItemsSource. This is a dependency property.
SelectedItem
Gets or sets the first item in the current selection or returns null if the selection is empty. This is a dependency property.
SelectedItems
Gets or sets the list of currently selected items for the RadAutoCompleteBox. This is a dependency property.
Declaration
public IEnumerable SelectedItems { get; set; }
Property Value
SelectionMode
Specifies the selection mode for the RadAutoCompleteBox. This is a dependency property.
Declaration
public AutoCompleteSelectionMode SelectionMode { get; set; }
Property Value
TextBoxStyle
Gets or sets the style of the RadWatermarkTextBox into the RadAutoCompleteBox. This is a dependency property.
Declaration
public Style TextBoxStyle { get; set; }
Property Value
Style
TextSearchMode
Specifies the text search mode for the RadAutoCompleteBox. This is a dependency property.
Declaration
public TextSearchMode TextSearchMode { get; set; }
Property Value
TextSearchPath
The name or path of the property that is used when filtering for each the data item in the control. The default is an empty string (""). This is a dependency property.
WatermarkContent
Gets or sets the content to be shown when the TextBox is not focused. When in Single SelectionMode, no item should be selected for the content to be visible. This is a dependency property.
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
[SuppressMessage("Microsoft.Usage", "CA1816:CallGCSuppressFinalizeCorrectly")]
[SuppressMessage("Microsoft.Usage", "CA2213:DisposableFieldsShouldBeDisposed", MessageId = "popupWrapper")]
[SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly")]
[Obsolete("The RadAutoCompleteBox control will no longer implement the IDisposable interface and this method will be removed in a future release.")]
public void Dispose()
Implements
GoToState(bool)
Updates the visual state of the control.
Declaration
protected void GoToState(bool useTransition)
Parameters
useTransition
Indicates whether transition should be used.
HandleKeyDown(Key)
Contains the keyboard navigation logic of RadAutoCompleteBox.
Declaration
protected virtual bool HandleKeyDown(Key systemKey)
Parameters
systemKey
Key
The key that has been pressed.
Returns
True if the KeyDown event should be handled, otherwise false.
OnApplyTemplate()
When overridden in a derived class, is invoked whenever application code or internal processes (such as a rebuilding layout pass) call .
Declaration
public override void OnApplyTemplate()
OnAutoCompleteModeChanged(AutoCompleteMode)
Called when the AutoCompleteMode property is changed.
Declaration
protected virtual void OnAutoCompleteModeChanged(AutoCompleteMode newValue)
Parameters
newValue
OnCreateAutomationPeer()
Returns class-specific AutomationPeer implementations for the Windows Presentation Foundation (WPF) infrastructure.
Declaration
protected override AutomationPeer OnCreateAutomationPeer()
Returns
AutomationPeer
The type-specific AutomationPeer implementation.
OnDisplayMemberPathChanged()
Called when the DisplayMemberPath property is changed.
Declaration
protected virtual void OnDisplayMemberPathChanged()
OnFilteringBehaviorChanged()
Called when the FilteringBehavior property is changed.
Declaration
protected virtual void OnFilteringBehaviorChanged()
OnGotFocus(RoutedEventArgs)
Called before the System.Windows.UIElement.GotFocus event occurs.
Declaration
protected override void OnGotFocus(RoutedEventArgs e)
Parameters
e
RoutedEventArgs
OnGotKeyboardFocus(KeyboardFocusChangedEventArgs)
Called before the System.Windows.UIElement.GotKeyboardFocus event occurs. Here the states of the AutoCompleteBox are updated. Added to work-around an issue with the Got and LostFocus events not getting fired.
Declaration
protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
Parameters
e
KeyboardFocusChangedEventArgs
OnHighlightBehaviorChanged()
Called when the HighlightBehavior property is changed.
Declaration
protected virtual void OnHighlightBehaviorChanged()
OnInitialized(EventArgs)
Raises the event. This method is invoked whenever is set to true internally.
Declaration
protected override void OnInitialized(EventArgs e)
Parameters
e
The RoutedEventArgs that contains the event data.
OnIsDropDownOpenChanged(bool)
Called when the IsDropDownOpen property is changed.
Declaration
protected virtual void OnIsDropDownOpenChanged(bool isOpen)
Parameters
isOpen
OnIsHighlightedChanged()
Called when the IsHighlighted property is changed.
Declaration
protected virtual void OnIsHighlightedChanged()
OnItemsSourceChanged(object, object)
Called when the ItemsSource property is changed.
OnLostFocus(RoutedEventArgs)
Called before the System.Windows.UIElement.LostFocus event occurs.
Declaration
protected override void OnLostFocus(RoutedEventArgs e)
Parameters
e
RoutedEventArgs
OnMouseWheel(MouseWheelEventArgs)
Called before the event occurs to provide handling for the event in a derived class without attaching a delegate.
Declaration
protected override void OnMouseWheel(MouseWheelEventArgs e)
Parameters
e
MouseWheelEventArgs
A MouseWheelEventArgs that contains the event data.
OnSelectedItemChanged(object)
Called when the SelectedItem property is changed.
Declaration
protected virtual void OnSelectedItemChanged(object newValue)
Parameters
newValue
OnSelectedItemsChanged(IEnumerable)
Called when the SelectedItems property is changed.
Declaration
protected virtual void OnSelectedItemsChanged(IEnumerable newValue)
Parameters
newValue
OnSelectionChanged(SelectionChangedEventArgs)
Called when the selection changes.
Declaration
protected virtual void OnSelectionChanged(SelectionChangedEventArgs e)
Parameters
e
SelectionChangedEventArgs
The event data.
OnSelectionModeChanged(AutoCompleteSelectionMode)
Called when the SelectionMode property is changed.
Declaration
protected virtual void OnSelectionModeChanged(AutoCompleteSelectionMode newValue)
Parameters
newValue
OnTextBoxStyleChanged()
Called when the TextBoxStyle property is changed.
Declaration
protected virtual void OnTextBoxStyleChanged()
OnTextSearchModeChanged(TextSearchMode)
Called when the TextSearchMode property is changed.
Declaration
protected virtual void OnTextSearchModeChanged(TextSearchMode textSearchMode)
Parameters
textSearchMode
OnTextSearchPathChanged()
Called when the TextSearchPath property is changed.
Declaration
protected virtual void OnTextSearchPathChanged()
OnWatermarkContentChanged()
Called when the WatermarkContent property is changed.
Declaration
protected virtual void OnWatermarkContentChanged()
Populate(string)
Searches through the AutoCompleteBox Items with the specified string input.
Declaration
public void Populate(string searchText)
Parameters
searchText
The string used to search in the AutoCompleteBox.
Events
Populated
Occurs when the filtering of the RadAutoCompleteBox is finished and the FilteredItems are populated.
Populating
Occurs before the RadAutoCompleteBox' items are filtered using the current SearchText.
Declaration
public event EventHandler<CancelRoutedEventArgs> Populating
Event Value
EventHandler<CancelRoutedEventArgs>
SearchTextChanged
Occurs when SearchText property changes.
SelectionChanged
Occurs when the selection of the RadAutoCompleteBox changes.
Declaration
public event SelectionChangedEventHandler SelectionChanged
Event Value
SelectionChangedEventHandler