Posted 10 Feb 2012 Link to this post
It seems that default behavior of RadCombobox is to clear selected item when control is focused, some item is selected and “Backspace” button is pressed.
I need to cancel this behavior in order to prevent setting of null as the selected combobox value. I tried to override KeyDown and KeyUp methods of RadCombobox and handle the click on “Backspace” but it did not fix the problem.
Are there any other ways to change this keyboard behavior?
Regards,
Andrii
Posted 15 Feb 2012 Link to this post
public
MainPage()
{
InitializeComponent();
RadComboBox1.AddHandler(KeyDownEvent,
new
KeyEventHandler(RadComboBox1_KeyDown),
true
);
}
string
combotxt;
private
void
RadComboBox1_KeyDown(
object
sender, KeyEventArgs e)
if
(e.Key==Key.Back)
(RadComboBox1.SelectedItem ==
null
)
RadComboBox1.EmptyText = combotxt;
RadComboBox1_SelectionChanged(
sender, Telerik.Windows.Controls.SelectionChangedEventArgs e)
combotxt = RadComboBox1.Text;