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

RadComboBox SelectionChanged Text Property Not Set Properly

1 Answer 532 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 20 Apr 2016, 12:19 PM

When processing the SelectionChanged event for a RadComboBox, the Text property of the control is not yet set with the new text value. For example, we add a RadComboBox with the SelectionChanged event set to the following OnSelectionChanged.

private void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
    RadComboBox cb = sender as RadComboBox;
    Trace.TraceInformation("cb.Text = {0}", cb.Text);
}

When we start typing in the Combo Box, the displayed text is always the Text value before the latest character. So,l when we type 1, cb.Text is null, when we type 2, the combo box displays "12", but cb.Text is 1.

How can we see the current value of the text box when the selection is changed?

1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 25 Apr 2016, 06:53 AM
Hi Richard,

You could try getting the Text using a Dispatcher like this:

Dispatcher.BeginInvoke(new Action(() =>
{
    Trace.TraceInformation("cb.Text = {0}", cb.Text);
}));

Let us know whether this will work for you.

Regards,
Yana
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
ComboBox
Asked by
Richard
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or