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

RadComboBoxItem Text Binding

2 Answers 323 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Vitali
Top achievements
Rank 1
Vitali asked on 03 Feb 2017, 04:18 AM

Hello. I have simple example

XAML:

<telerik:RadComboBox 
    Width="100" Height="25"
    IsEditable="True" 
    Text="{Binding Value, Mode=TwoWay}" >
            <telerik:RadComboBoxItem Content="20"/>
            <telerik:RadComboBoxItem Content="10"/>
            <telerik:RadComboBoxItem Content="2"/>
            <telerik:RadComboBoxItem Content="1"/>
</telerik:RadComboBox>

 

ViewModel:

    public class ViewModel {
        public int Value { get; set; }
    }

 

Behavior:

    public partial class MainWindow : Window {
        public MainWindow() {
            InitializeComponent();

            DataContext = new ViewModel() { Value = 2 };
        }
    }

ComboBox selected another value instead of '2'

2 Answers, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 07 Feb 2017, 09:49 AM
Hi Vitali,

We are aware of the observed by you issue and it has already been logged in our internal backlog. We have created a Feedback item where you could easily vote for the item and track its status. The item could be found on the following link:
https://feedback.telerik.com/Project/143/Feedback/Details/211862-combobox-the-text-property-is-not-updated-to-the-correct-autocompleted-item-when

Currently, we could not suggest you any proper workaround. The reason for the experienced behavior is because when the ComboBox is getting its Text property it:
  • Automatically triggers its searching feature with the new text
  • Tries to find a matching item
  • If there is such item it is selected
  • Finally the Text of the RadComboBox is updates to match the text of the found item
And because in your scenario the item with Content 20 is before the one with Content 2 it is found first and it is selected - the text is also updated in order to match the one of the found item. If the IsTextSearchEnabled is set to False the issue will not be observed.

We apologize for the concerns the issue might be causing you.

If you have any additional questions or concerns regarding Telerik controls, please do not hesitate to contact us.

Regards,
Nasko
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Vitali
Top achievements
Rank 1
answered on 10 Feb 2017, 08:10 AM
thanks for the help
Tags
ComboBox
Asked by
Vitali
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Vitali
Top achievements
Rank 1
Share this question
or