I have a few RadNumericUpDown controls bound in TwoWay mode to properties. I have the following code that does get called when the KeyUp event occurs:
If I use this code on a TextBox the source is updated with the correct value but if I use a RadComboBox it does not update the source. What am I doing wrong?
What I'm trying to accomplish is to update all my bindings whenever a change is made to the RadNumericUpDown control without having to lose focus on the control. Pressing the up/down buttons in the control do update my bindings but typing numbers in the control do not until the contolr loses focus.
private
void
KeyUp(
object
sender, KeyEventArgs e)
{
FrameworkElement fe = (FrameworkElement) sender;
BindingExpression exp;
if
(fe
is
TextBox)
{
exp = fe.GetBindingExpression(TextBox.TextProperty);
}
else
if
(fe
is
RadNumericUpDown)
{
exp = fe.GetBindingExpression(RadRangeBase.ValueProperty);
}
else
{
throw
new
Exception(
"Invalid type"
);
}
exp.UpdateSource();
}
If I use this code on a TextBox the source is updated with the correct value but if I use a RadComboBox it does not update the source. What am I doing wrong?
What I'm trying to accomplish is to update all my bindings whenever a change is made to the RadNumericUpDown control without having to lose focus on the control. Pressing the up/down buttons in the control do update my bindings but typing numbers in the control do not until the contolr loses focus.