This is a migrated thread and some comments may be shown as answers.

SelectedValue / Text properites mismatch

2 Answers 62 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Marcin
Top achievements
Rank 1
Marcin asked on 01 Aug 2013, 03:02 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Kalin
Telerik team
answered on 06 Aug 2013, 03:10 PM
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 >>
0
Marcin
Top achievements
Rank 1
answered on 06 Aug 2013, 03:14 PM
Hi Kalin,

thank You for explanation. Now it's clear.

Best regards
Marcin
Tags
ComboBox
Asked by
Marcin
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Marcin
Top achievements
Rank 1
Share this question
or