Articles in this section

How to notify the selection changed in WinUI SfAutoComplete?

In this article, you will learn how to handle selection changes in the WinUI AutoComplete using the SelectionChanged event. This event provides details about the items that were added or removed during the selection change, through its AddedItems and RemovedItems properties.

  • AddedItems - Contains the items that were newly selected.
  • RemovedItems - Contains the items that were unselected.
<editors:SfAutoComplete 
   SelectionChanged="OnSelectionChanged"
   TextMemberPath="Name"
   DisplayMemberPath="Name"
   ItemsSource="{Binding SocialMedias}" 
   Width="250"
   x:Name="autoComplete"/> 

The ‘SelectionChanged’ event can be handled as follows.

private async void OnSelectionChanged(object sender, AutoCompleteSelectionChangedEventArgs e)
{
   var cd = new ContentDialog
   {
       Content = "Selected item was changed.",
       CloseButtonText = "Close"
   };

   cd.XamlRoot = this.Content.XamlRoot;
   var result = await cd.ShowAsync();
}

winui-AutoComplete-selectionchanged.gif

Conclusion

I hope you enjoyed learning about how to notify the selection changed in WinUI SfAutoComplete.

You can refer to our WinUI Autocomplete feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications.

For current customers, you can check out our components from the Licence and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forum, Support portal, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied