Articles in this section

How to customize the NoResultsFound text in the WinUI SfAutoComplete?

In this article, we demonstrate how to set a custom value or template when the user enters invalid input in the WinUI SfAutoComplete control. When the entered text or item does not match with any item in the suggestion list, SfAutoComplete displays a message indicating that no results were found. You can customize this message using the NoResultsFoundContent and NoResultsFoundTemplate properties.

NoResultsFoundContent:

The NoResultsFoundContent property allows you to customize the text displayed when no matching results are found. The following code sample shows how to set the NoResultsFoundContent in the SfAutoComplete control.

<editors:SfAutoComplete  Header="AutoComplete with No Result Found Text" 
                         PlaceholderText="Search a country" 
                         DisplayMemberPath="Country" 
                         TextMemberPath="Country"
                         Width="300"   
                         NoResultsFoundContent="Not Found"
                         ItemsSource="{Binding ContinentList }">
</editors:SfAutoComplete>

NoFoundContent.png

NoResultsFoundTemplate:

You can customize the appearance of the message displayed when no results are found by using the NoResultsFoundTemplate property. The following example demonstrates how to use the NoResultsFoundTemplate in the SfAutoComplete control.

<editors:SfAutoComplete  Header="AutoComplete with No Result Found Template"
                          PlaceholderText="Search a country" 
                          DisplayMemberPath="Country" 
                          TextMemberPath="Country"
                          Width="300"    
                          ItemsSource="{Binding ContinentList }">
           <editors:SfAutoComplete.NoResultsFoundTemplate>
               <DataTemplate>
                   <TextBlock Text="Not Found" 
                       Foreground="Red" 
                       FontStyle="Italic" 
                       FontSize="20"  />
               </DataTemplate>
           </editors:SfAutoComplete.NoResultsFoundTemplate>
</editors:SfAutoComplete>

NoFoundTemplate.png

Conclusion

I hope you enjoyed learning How to customize the NoResultsFound text in the WinUI SfAutoComplete.

You can refer to our WinUI Autocomplete feature tour page to learn 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 f 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