Contains vs StartsWith and autocompletion

2 posts, 0 answers
  1. Thomas
    Thomas avatar
    1 posts
    Member since:
    Aug 2014

    Posted 25 Aug 2014 Link to this post

    HI.

    In the following example, I use a RadComboBox with TextSearchMode="Startswith".

    <telerik:RadComboBox  
                            ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor,  AncestorType={x:Type UserControl}},Path=DataContext.Sagsbehandler}" 
                            SelectedValue="{Binding SagsbehandlerId, ValidatesOnDataErrors=True, UpdateSourceTrigger=LostFocus}" 
                            SelectedValuePath="SagsbehandlerId"
                            DisplayMemberPath="Navn"                    
                            IsEditable="True"
                            TextSearchMode="StartsWith"
                            >
    When typing the first letters of an item in the itemssource, the first match is selected/autocompleted in the editable area.

    However: If I change TextSearchMode to "Contains", there is no autocompletion as I initially would have expected. Only the typed text is shown and the user has no clue if the typed text has any match in the itemssource.
    How can I change this behaviour? That is, how can I enable autocompletion when using a contains search.


  2. Alek
    Admin
    Alek avatar
    78 posts

    Posted 27 Aug 2014 Link to this post

    Hi Thomas,

    In the current implementation of the control you cannot apply the append functionality with TextSearchMode set to "Contains". If we add a text before the typed symbol it will affect the Search functionality of the control and in many cases the result will be not relevant. 

    There is another of our controls which can be suitable for your purposes - RadAutoCompleteBox. The autocompletion in "Contains" mode will still not work as you are expecting but there is a dropdown where the filtering can be seen. In the link pasted below you can find an example showing how to equip the control with a dropdown button so it will be more like RadComboBox. Please, take a look at it - 

    https://github.com/telerik/xaml-sdk/tree/master/AutoCompleteBox/OpenWithDropDownButton

    We hope that the proposed solution will be suitable for your project. 

    Regards,
    Alek
    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.
     
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top