FilteredItemsSourceProvider Class
A data provider that supplies suggestions for the AutoCompleteEdit and AutoCompleteColumn in sync mode.
Namespace: DevExpress.XamarinForms.Editors
Assembly: DevExpress.XamarinForms.Editors.dll
NuGet Package: DevExpress.XamarinForms.Editors
Declaration
public class FilteredItemsSourceProvider :
ItemsSourceProviderBase
Remarks
The FilteredItemsSourceProvider
filters the data item collection based on the filter settings. The filtered collection is then automatically assigned to the editor’s ItemsSource property.
Use the provider’s SuggestionsSource property to specify the collection of suggestions. The table below contains options that define how the provider searches for suggestions in the collection.
Property/Event | Description |
---|---|
Specifies whether suggestions should start with or contain the entered text. | |
Specifies culture and case rules used to compare the entered text with suggestions. | |
Specifies which data fields to search. |
Examples
The example below uses the FilteredItemsSourceProvider
to supply suggestions for the AutoCompleteEdit.
<ContentPage.BindingContext>
<local:AutoCompleteEditViewModel/>
</ContentPage.BindingContext>
<dxe:AutoCompleteEdit>
<dxe:AutoCompleteEdit.ItemsSourceProvider>
<dxe:FilteredItemsSourceProvider SuggestionsSource="{Binding ItemsSource}"
FilterMode="Contains"
FilterComparisonType="CurrentCultureIgnoreCase"
FilterMembers="Name, Capital"/>
</dxe:AutoCompleteEdit.ItemsSourceProvider>
<dxe:AutoCompleteEdit.ItemTemplate>
<DataTemplate>
<Grid>
<Label Padding="10" Text="{Binding Name}" FontAttributes="Bold"/>
<Label Padding="10" Grid.Column="1" Text="{Binding Abbr}"/>
<Label Padding="10" Grid.Column="2" Text="{Binding Capital}" HorizontalTextAlignment="End"/>
</Grid>
</DataTemplate>
</dxe:AutoCompleteEdit.ItemTemplate>
</dxe:AutoCompleteEdit>
The example below uses the FilteredItemsSourceProvider
to supply suggestions for the AutoCompleteColumn.
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:dxe="http://schemas.devexpress.com/xamarin/2014/forms/editors"
xmlns:dxg="http://schemas.devexpress.com/xamarin/2014/forms/datagrid"
xmlns:scg="clr-namespace:System.Collections.Generic;assembly=netstandard">
<ContentPage.Content>
<dxg:DataGridView ItemsSource="{Binding Path=Employees}">
<dxg:DataGridView.Columns>
<dxg:AutoCompleteColumn FieldName="JobTitle">
<dxg:AutoCompleteColumn.ItemsSourceProvider>
<dxe:FilteredItemsSourceProvider FilterMode="Contains"
FilterComparisonType="CurrentCultureIgnoreCase">
<dxe:FilteredItemsSourceProvider.SuggestionsSource>
<scg:List x:TypeArguments="x:String">
<x:String>Chief Executive Officer</x:String>
<x:String>Network Administrator</x:String>
</scg:List>
</dxe:FilteredItemsSourceProvider.SuggestionsSource>
</dxe:FilteredItemsSourceProvider>
</dxg:AutoCompleteColumn.ItemsSourceProvider>
</dxg:AutoCompleteColumn>
</dxg:DataGridView.Columns>
</dxg:DataGridView>
</ContentPage.Content>
</ContentPage>