RadComboBoxItem Text Binding

3 posts, 0 answers
  1. Vitali
    Vitali avatar
    2 posts
    Member since:
    Sep 2016

    Posted 02 Feb Link to this post

    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. Nasko
    Admin
    Nasko avatar
    652 posts

    Posted 07 Feb Link to this post

    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.
  3. Vitali
    Vitali avatar
    2 posts
    Member since:
    Sep 2016

    Posted 10 Feb in reply to Nasko Link to this post

    thanks for the help
Back to Top