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

DropDownClosed clears Text

2 Answers 81 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 22 Aug 2012, 02:21 PM
Hello,

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?

Thanks,

Jason

2 Answers, 1 is accepted

Sort by
0
Jason
Top achievements
Rank 1
answered on 22 Aug 2012, 03:20 PM
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.


0
Vladi
Telerik team
answered on 27 Aug 2012, 09:26 AM
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.

Greetings,
Vladi
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
ComboBox
Asked by
Jason
Top achievements
Rank 1
Answers by
Jason
Top achievements
Rank 1
Vladi
Telerik team
Share this question
or