How to set filter text from code

Hello,

We need to set "filtering" text from C# code. The scenario is, that beside SfAutoComplete control we have QR code scanning button, which takes user to camera-app where she/he needs to scan a QR code.

After successful QR code scan, she/he is returned from camera-app to the app and information that was coded into QR data should be put into SfAutoComplete control as a "filtering" text. That means, that SfAutoComplete control should do search in bound data list and suggest only data that matches the search criteria. It should behave the same as user would type the text by himself into the SfAutoComplete control via keyboard - in our scenario, the typing via keyboard is replaced by scanning QR code.

Any suggestions how to set "filtering" text in C# code?


1 Reply

HC Hariharan Chokkalingam Syncfusion Team September 3, 2024 12:43 PM UTC

Hi Kristian,

 

Thank you for reaching out to us. We have reviewed your query based on your update. We would like to inform you that you can directly bind the QR scanned data text to the Text property of the Autocomplete. Additionally, you can set ShowSuggestionsOnFocus to true, so whenever the control gains focus, it will display the suggestions.

 

We have created a sample with a button click event, where upon clicking the button, we add the text, set ShowSuggestionsOnFocus to true, and then focus the control. This will achieve the desired output you are expecting.

 

For your reference, we have attached a video demonstrating the output, along with the sample code. Kindly review the reference and share your feedback. Please let us know if the provided solution helps to resolve your query. Don’t hesitate to contact us if you have any further concerns or questions.

 

Regards,

Hariharan C.


Attachment: Reference_55ac1e76.zip

Loader.
Up arrow icon