Highlight no item by default

7 posts, 0 answers
  1. Alex
    Alex avatar
    141 posts
    Member since:
    Mar 2010

    Posted 04 Aug 2014 Link to this post

    Can the control be changed to not highlight the first item by default?


    In my specific case I use the auto complete for name searching, and often there are multiple matches (e.g. many "john smiths") and it is preferable to never highlight an item, but there is no "CurrentItem" or similar. It is too easy for users to hit enter/tab and "select" the top item, where was what is really wanted is enter/tab to simply run my "search" command. 

    Ideally the user must manually highlight or select an item
  2. Alex
    Alex avatar
    141 posts
    Member since:
    Mar 2010

    Posted 04 Aug 2014 in reply to Alex Link to this post

    Sorry just noticed that HighlightBehaviour

    This property satisfies my requirements
  3. DevCraft banner
  4. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 05 Aug 2014 Link to this post

    Hello Alex,

    For more details about how to implement a custom HighlightBehavior you can check the following article from our online help documentation:
    http://www.telerik.com/help/silverlight/radautocompletebox-features-highlightbehavior.html

    Hope this helps.

    Regards,
    Kalin
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  5. Michael
    Michael avatar
    18 posts
    Member since:
    Jul 2012

    Posted 05 Oct 2014 in reply to Kalin Link to this post

    Sorry, I am trying to do the exact same thing and I cannot figure out how to achieve this behavior with a HighlightBehavior. How do you have a behavior which does not select an item unless the user manually chooses one? I tried returning -1 in FindHighlightedIndex and that doesn't seem to work.
  6. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 06 Oct 2014 Link to this post

    Hi Michael,

    By returning -1 in the FindHighlightedIndex() method you should be able to achieve the desired. I just tested and it works as expected (nothing is highlighted in this case). However I will ask you to share some sample code, so we can check the issue you are observing and provide further assistance.

    I'm looking forward to hearing from you.

    Regards,
    Kalin
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  7. Michael
    Michael avatar
    18 posts
    Member since:
    Jul 2012

    Posted 06 Oct 2014 in reply to Kalin Link to this post

    Thanks for the -1 tip. I did that and it works in all cases except when there is only one item in the filter results. In this case (only one item), the single item is always highlighted. Can this be fixed somehow?
  8. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 07 Oct 2014 Link to this post

    Hello Michael,

    Indeed when there is a single item filtered it always get highlighted even -1 is returned from the custom HighlightBehavior. This behavior is intended by design as whenever there is only one matching item, it is the item that the user would like to select and it automatically becomes highlighted. Currently I'm afraid that behavior cannot be overridden.

    If you have any other questions let us know.

    Regards,
    Kalin
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
DevCraft banner