Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match highlighting on the results #52

Open
dejanbasic opened this issue Jul 9, 2019 · 5 comments
Open

Match highlighting on the results #52

dejanbasic opened this issue Jul 9, 2019 · 5 comments
Labels
enhancement New feature or request F-AutoSuggestBox Feature: AutoSuggestBox control

Comments

@dejanbasic
Copy link

Hello, I need to implement highlighting of search query on the matched results. Is there a way to do that?

@dotMorten
Copy link
Owner

I don't think any of the native controls used supports this, so I don't see a way to do this

@dejanbasic
Copy link
Author

This is Syncfusion Xamarin.Forms Autocomplete control:

How they do this?

@dotMorten
Copy link
Owner

@dejanbasic I'm guessing they don't rely on native controls but custom forms control?

@dotMorten
Copy link
Owner

Notes: iOS example using attributed text: https://github.com/dinarajas/HighlightLabel/blob/master/classes/HighlightLabel.m

@dotMorten dotMorten added enhancement New feature or request F-AutoSuggestBox Feature: AutoSuggestBox control labels Nov 12, 2019
@dejanbasic
Copy link
Author

I implemented my own custom solution in Xamarin.Forms, which looks like this:

Screenshot 2019-11-13 at 13 35 55

I used Entry control for search box and ListView for showing search results. I managed to highlight matched results, by using Label->FormattedText->FormattedString->Span controls, to split text into three parts: first part, highlighted text and last part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request F-AutoSuggestBox Feature: AutoSuggestBox control
Projects
None yet
Development

No branches or pull requests

2 participants