DropDownClosed clears Text

3 posts, 0 answers
  1. Jason
    Jason avatar
    25 posts
    Member since:
    Aug 2012

    Posted 22 Aug 2012 Link to this post


    I am having trouble keeping the text value after the dropdown closes when nothing is selected.

    I populate the text property with a value that is not in the ItemsSource.  If a user clicks the dropdown to expand it and then closes the dropdown without selecting an item, the text is set to null.

    I populate the EmptyText property with the value of text hoping that would keep it from becoming empty but that does not work.  I also caught the dropdownclosed event thinking that if the SelectedItem was null I would repopulate the text.  This did not matter because at that point the text is still populated.

    Can you please throw me an idea?


  2. Jason
    Jason avatar
    25 posts
    Member since:
    Aug 2012

    Posted 22 Aug 2012 Link to this post

    I will need to move on to another solution if this cannot be answered soon.  I have tried comboBox.AddHandler(TextBoxBase.TextChangedEvent, new RoutedEventHandler... this allows me to set the text property back to what it was in he case that it is blank or null, but it does not show up on the screen until the control loses focus.  This is unacceptable.

  3. DevCraft banner
  4. Vladi
    Vladi avatar
    743 posts

    Posted 27 Aug 2012 Link to this post

    Hello Jason,

    We tried to reproduce the issue but with no success -  if you bind the EmptyText property of the ComboBox control and then open and close the drop down the EmptyText value is shown as expected.

    I have prepared and attached a sample project for you showing how to correctly set the EmptyText. If I have misunderstood the issue or if I am missing something, please let me know.

    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top