Can't make Editable RadComboBox and Bindings work!

7 posts, 0 answers
  1. GVera
    GVera avatar
    10 posts
    Member since:
    Nov 2008

    Posted 29 Mar 2011 Link to this post

    Hi,

    I have a RadComboBox binded to objects in my ViewModel.  I have it as IsEdiatble = true since I want users to be able to add a new value if it does not exist in the drop down list.  So far, I can type the new value but I can't find a way on getting that new value input by the user.  Any help will be apreciated:

    NOTE:  When the selected item changes I am using a Command propoerty from my ViewModel and it is working properly.

    My Bindings:
    MyObject = A Class with 2 properties (FieldName (String)  and TableName (String))
    FieldList = Generic List<MyObject>
    SlectedField = MyObject
    ValueChanged = a command property (ICommand)

    ItemsSource = {Binding FieldList} SelectedValuePath="FieldName" DisplayMemberPath="FieldName" SelectedItem={Binding SlectedField} Command={Binding ValueChanged}

    Thanks.
  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 01 Apr 2011 Link to this post

    Hello GVera,

    RadComboBox doesn't allow to add new items like this. You can only enter text (when IsEditable is true) in order to search in the existing values.  We hope that this is not major show-stopper for you.

    Greetings,
    Yana
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
  4. GVera
    GVera avatar
    10 posts
    Member since:
    Nov 2008

    Posted 01 Apr 2011 Link to this post

    Hi,

    Thanks for the late response.  After some trying, I found a way to get the Editable TextBox through the visual tree of the RadComboBox element and set bindings to an object in my ViewModel.  I was able to then check the value and perform my operations.

    Thanks again.
  5. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 01 Apr 2011 Link to this post

    Hello GVera,

    I'm glad that you've managed to find a suitable way to implement the needed approach.

    All the best,
    Yana
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Nicolo
    Nicolo avatar
    9 posts
    Member since:
    Aug 2012

    Posted 02 Nov 2012 Link to this post

    Hello GVera
    I have the same scenario as you and have been searching around for a solution, but with no success. Could you or somebody from Telerik elaborate the solution?

    Thanks in advance.
    Nicolo
  7. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 08 Nov 2012 Link to this post

    Hello Nicolo,

    There is really no easy way to achieve the desired behavior. The only workaround we can suggest is to use LostFocus event of RadComboBox, to get the entered text from Text property and add it to the collection which is bound to the ItemsSource of the ComboBox.

    Hope this helps.

    All the best,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  8. Nicolo
    Nicolo avatar
    9 posts
    Member since:
    Aug 2012

    Posted 08 Nov 2012 Link to this post

    Hello Yana
    Thanks for the response. Will try it.
    Kind regards
    Nicolo
Back to Top
UI for WPF is Visual Studio 2017 Ready