<autocomplete:SfAutoComplete x:Name="autoComplete"
HeightRequest="45"
DropDownFooterViewHeight="60"
ValueChanged="AutoComplete_ValueChanged"
NoResultsFoundText="No Results"
DisplayMemberPath="Name">
<autocomplete:SfAutoComplete.DropDownFooterView>
<Grid VerticalOptions="StartAndExpand" HeightRequest="60" BackgroundColor="#f0f0f0" >
<busyIndicator:SfBusyIndicator VerticalOptions="Start" x:Name="busyindicator"
AnimationType="SlicedCircle"
ViewBoxWidth = "40"
ViewBoxHeight="40"
TextColor="Maroon"
IsBusy="True"/>
</Grid>
</autocomplete:SfAutoComplete.DropDownFooterView>
</autocomplete:SfAutoComplete> |
public partial class MainPage : ContentPage
{
AutoCompletetViewModel dataBaseViewModel = new AutoCompletetViewModel();
public ObservableCollection<Employee> EmployeeCollection { get; set; }
public MainPage()
{
InitializeComponent();
autoComplete.BindingContext = this;
}
private void AutoComplete_ValueChanged(object sender, Syncfusion.SfAutoComplete.XForms.ValueChangedEventArgs e)
{
DataChanged();
}
private async void DataChanged()
{
await Task.Delay(4000);
busyindicator.IsBusy = false;
autoComplete.DropDownFooterViewHeight = 0;
if (autoComplete.DataSource == null)
{
EmployeeCollection = new ObservableCollection<Employee>();
var Emp = dataBaseViewModel.ItemsSource.GetItems<Employee>();
foreach (Employee emp in Emp)
{
EmployeeCollection.Add(emp);
}
autoComplete.DataSource = EmployeeCollection;
}
}
} |
<autocomplete:SfAutoComplete x:Name="autoComplete"
HeightRequest="45"
DropDownFooterViewHeight="60"
ValueChanged="AutoComplete_ValueChanged"
NoResultsFoundText="No Results"
DisplayMemberPath="Name"/> |
private void AutoComplete_ValueChanged(object sender, Syncfusion.SfAutoComplete.XForms.ValueChangedEventArgs e)
{
string enteredText = autoComplete.Text;
string enteredValue = e.Value;
} |
<StackLayout Padding="10"> <Label Text="{Binding Source={x:Reference autoComplete},Path=Text}"/> <autocomplete:SfAutoComplete x:Name="autoComplete"
HeightRequest="45"
DropDownFooterViewHeight="60"
ValueChanged="AutoComplete_ValueChanged"
NoResultsFoundText="No Results"
DisplayMemberPath="Name"/> </StackLayout> |
Hi Zeeshan,Thanks for your update.We will wait until hear from you.Regards,Hemalatha M.
<autocomplete:SfAutoComplete
HeightRequest="45"
DropDownFooterViewHeight="60"
ValueChanged="AutoComplete_ValueChanged"
NoResultsFoundText="No Results"
DisplayMemberPath="Name">
<autocomplete:SfAutoComplete.ItemTemplate>
<DataTemplate >
<StackLayout Orientation="Horizontal">
<Label Text="{Binding Value}"/>
<Label Text="{Binding Code}"/>
</StackLayout>
</DataTemplate>
</autocomplete:SfAutoComplete.ItemTemplate>
</autocomplete:SfAutoComplete> |
<StackLayout VerticalOptions="Center" Padding="10">
<Label Text="Entered Text" FontAttributes="Bold"/>
<StackLayout Orientation="Horizontal">
<Label Text="{Binding Source={x:Reference autoComplete},Path=Text}"/>
<Label x:Name="resultLabel"/>
</StackLayout>
<autocomplete:SfAutoComplete x:Name="autoComplete" SelectionChanged="AutoComplete_SelectionChanged"
HeightRequest="45"
DropDownFooterViewHeight="60"
ValueChanged="AutoComplete_ValueChanged"
NoResultsFoundText="No Results"
DisplayMemberPath="Name">
…
</autocomplete:SfAutoComplete>
</StackLayout> |
private void AutoComplete_SelectionChanged(object sender, Syncfusion.SfAutoComplete.XForms.SelectionChangedEventArgs e)
{
resultLabel.Text = (e.AddedItems as Employee).Code;
} |