SelectedValue / Text properites mismatch

3 posts, 1 answers
  1. Marcin
    Marcin avatar
    31 posts
    Member since:
    Jul 2013

    Posted 01 Aug 2013 Link to this post

    Hi,

    when using RadComboBox in following scenario:

    <telerik:RadComboBox ItemsSource="{Binding SampleValues}" SelectedValue="{Binding SelectedValue, Mode=TwoWay}" Text="{Binding Text, Mode=TwoWay}" IsEditable="True" Height="23" TextSearchMode="StartsWith" IsTextSearchEnabled="True" />
    there is a scenario, when control's behavior is strange.

    1) Start typing word, that is in Items list (e.g. 'a' - the value 'aaa' is found and set as Text and SelectedValue)
    2) When the whole word is suggested, press "delete" button, to remove the suggested part ('a' value is Binded to Text, but SelectedValue has 'aaa' value)
    Pressing another letter fixes the properties synchronization  (clears the SelectedValue property)

    Best regards
    Marcin Danek
  2. Answer
    Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 06 Aug 2013 Link to this post

    Hi Marcin,

    The described ComboBox behavior is expected as when you start typing an existing value it autocompletes it and assigns it to the SelectedValue property. When you delete the suggested part the SelectedValue doesn't change as the typed text is still matching the item, that's why when you type another different letter it deletes the SelectedValue (it doesn't match anything from the ItemsSource). On other hand the Text property represents the text currently typed in the input field and it changes on every key pressed.

    If you want to avoid this behavior of the SelectedValue you can set CanAutocompleteSelectItems="False" which will not auto select an item after first letter typed. Please note that this property works only when the dropdown is opened, so in order to use it you should set OpenDropDownOnFocus="True" to always have the dropdown open when in focus.

    Hope this helps.

    Regards,
    Kalin
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. DevCraft banner
  4. Marcin
    Marcin avatar
    31 posts
    Member since:
    Jul 2013

    Posted 06 Aug 2013 Link to this post

    Hi Kalin,

    thank You for explanation. Now it's clear.

    Best regards
    Marcin
Back to Top