Windows Dev Center

Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

AutoCompleteBox.ItemsSource Property

Silverlight

Gets or sets a collection that is used to generate the items for the drop-down portion of the AutoCompleteBox control.

Namespace:  System.Windows.Controls
Assembly:  System.Windows.Controls.Input (in System.Windows.Controls.Input.dll)

public IEnumerable ItemsSource { get; set; }
<sdk:AutoCompleteBox ItemsSource="bindingDeclaration"/>
-or-
<sdk:AutoCompleteBox ItemsSource="resourceReferenceToIEnumerable"/>

XAML Values

bindingDeclaration

A Binding declaration using a {Binding ...} markup extension. For more information, see Binding Markup Extension or Binding.

resourceReferenceToIEnumerable

A resource reference to an existing object of type IEnumerable from a resources collection. The resource reference must specify the desired IEnumerable by key.

Property Value

Type: System.Collections.IEnumerable
The collection that is used to generate the items of the drop-down portion of the AutoCompleteBox control.

The following example shows an AutoCompleteBox that provides a list of cities to complete an entry in its text box. This code example requires a reference to the System.Windows.Controls.Input assembly.

Run this sample


public Page()
{
    InitializeComponent();
    List<string> cities = new List<string>();
    cities.Add("London");
    cities.Add("Seattle");
    cities.Add("Tokyo");
    cities.Add("Nairobi");
    cities.Add("Lisbon");
    cities.Add("New York");
    cities.Add("Paris");
    cities.Add("San Francisco");
    citiesACB.ItemsSource = cities;
}



<Border BorderThickness="3" BorderBrush="Black">
    <StackPanel Background="LightGray">
        <TextBlock Text="AutoCompleteBox Control" Margin="5"/>
        <StackPanel x:Name="LayoutRoot"  Orientation="Horizontal">
            <TextBlock Text="Destination: " Margin="5" VerticalAlignment="Center" />
            <sdk:AutoCompleteBox x:Name="citiesACB" Width="200" />
        </StackPanel>
    </StackPanel>
</Border>


Silverlight

Supported in: 5, 4, 3

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

Show:
© 2015 Microsoft