In Edit Mode, prevent the Combobox from updating the source

12 posts, 0 answers
  1. Ben Boger
    Ben Boger avatar
    19 posts
    Member since:
    May 2010

    Posted 30 Jun 2011 Link to this post

    I have a scenario where I would like to use the combobox and its autocomplete functionality however I want to bind the text to a property. I don't want that property to update everykeystroke, surely there is a way to change the way this is updating so I can have autocomplete and only update at the end, leave focus maybe.

    I've look at the documentation and I didn't see anything describing this, maybe I just missed it. If thats the case I would love to be pointed in the right direction

    thanks in advance,


  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 01 Jul 2011 Link to this post

    Hi Ben,

    Please try setting CanAutocompleteSelectItems property of the ComboBox to false and StaysOpenOnEdit and OpenDropDownOnFocus to true, also bind SelectedItem property instead of Text - it will be updated when the item is selected with "Enter" or with the mouse:

    <telerik:RadComboBox Width="200" x:Name="radComboBox"
                            IsEditable="True"
                            ItemsSource="{Binding Source={StaticResource DataSource}, Path=Items}"
                            DisplayMemberPath="Name"
                            CanAutocompleteSelectItems="false"
                            StaysOpenOnEdit="True"
                            OpenDropDownOnFocus="True"                        
                            SelectedItem="{Binding Source={StaticResource DataSource}, Path=SelectedItem, Mode=TwoWay}"                               
                            />

    Hope this helps.

    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. DevCraft banner
  4. Ben Boger
    Ben Boger avatar
    19 posts
    Member since:
    May 2010

    Posted 01 Jul 2011 Link to this post

    The one thing I didn't try was using the SelectedItem that doesn't seem to make a difference. I am curious, when I was trying to get this working I had run across this post that says the StaysOpenOnEdit is not used has this changed since this post ?
  5. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 05 Jul 2011 Link to this post

    Hi Ben,

    StaysOpenOnEdit is not marked as obsolete yet,  but you're right that it's not needed.  I'm sorry for my confusion.

    I've attached our test project and a short video showing that the described approach works as expected at our side. Could you please check them and let us know what is different in your case?

    Greetings,
    Yana
    the Telerik team
    Register for the Q2 2011 What’s New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
  6. Ben Boger
    Ben Boger avatar
    19 posts
    Member since:
    May 2010

    Posted 05 Jul 2011 Link to this post

    I just downloaded and tried your demo, I'll give you credit, it does work the very first time for updating. however, if you submit you choice and then change it , it seems to actually go back to updating every keystroke as mentioned before. For me, this is inconsistent and an undesired result.
  7. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 08 Jul 2011 Link to this post

    Hello Ben,

    Can you please confirm that you're using Q1 2011 SP1 version of the RadControls?  Also can you send us a short video showing the problem? Thanks in advance

    Greetings,
    Yana
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  8. Ben Boger
    Ben Boger avatar
    19 posts
    Member since:
    May 2010

    Posted 08 Jul 2011 Link to this post

    I am currently using 2011 SP1. Maybe I'm not stating the problem clearly enough.

    1. Start the project, click in the combobox and starttyping something that would be in the list. At this point everything should be working well.
    2. To Submit a choice, hit enter. First time through this works nicely, the selected item doesn't get updated until the very end.

    3. click back into the project and start typing. At this point you should be able to notice the SelectedItem getting updated every keystroke.
  9. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 14 Jul 2011 Link to this post

    Hi Ben,

    The SelectedValue of the RadComboBox is updated on every keystroke when the dropdown is closed - is this the situation that you're describing?  Currently this is the default behavior of the ComboBox, but we'll consider changing it.

    Best wishes,
    Yana
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  10. Ben Boger
    Ben Boger avatar
    19 posts
    Member since:
    May 2010

    Posted 14 Jul 2011 Link to this post

    I just want the option of choosing my mode of update.
  11. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 15 Jul 2011 Link to this post

    Hello Ben,

    Thank you for sending this feature request, it will definitely be considered for the upcoming releases of RadComboBox.

    Regards,
    Yana
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  12. Michael
    Michael avatar
    2 posts
    Member since:
    Dec 2011

    Posted 20 Dec 2011 Link to this post

    Hello,

    Has there been an update to this, or is there any other way of NOT updating the source with each keystroke when the autocomplete dropdown is not open?

    I have a RadGridView with a column as below, and the bindings are working however the source is updated with each keystroke and I want it only updated when the user finishes editing.

    <telerik:GridViewDataColumn Header="Axis" Width="*" DataMemberBinding="{Binding Axis, Mode=TwoWay}"

    CellStyle="{StaticResource NormalCellStyle}" >
    <telerik:GridViewColumn.CellEditTemplate>
      <DataTemplate>
       
    <telerik:RadComboBox x:Name="AxisCB" ItemsSource="{Binding Source={StaticResource AxisListViewSource}}" Text="{Binding Path=Axis, Mode=TwoWay}" 
    EmptyText="" IsEditable="True" >
        </telerik:RadComboBox>
      </DataTemplate>
    </telerik:GridViewColumn.CellEditTemplate>
    </telerik:GridViewDataColumn>


  13. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 21 Dec 2011 Link to this post

    Hi Michael,

    I am afraid that the behavior is not changed and the value is still updated on every keystroke when the dropdown is closed. We're sorry for the inconvenience.

    All the best,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top
DevCraft banner