I have a DoubleEditBox in a view. In our product I can edit the doubleEditBox and do an operation (e.g. click on another tab) such that the doubleEditBox is removed from the view. Because the binding is on LostFocus, when i come back to the view, the value is lost.
Our solution which does not work:
Before the view is removed, we are trying to update the ViewModel this way (the code is called from a service):
var focusedElementDoubleEditBox = FocusManager.GetFocusedElement(Application.Current.MainWindow) as FrameworkElement;
var expression = focusedElementDoubleEditBox.GetBindingExpression(DoubleEditBox.ValueProperty)
expression.UpdateSource();
The problem is
1. Focused Element is not DoubleEditBox but it is MaskedTextBox.
2. If I use MaskedTextBox and get DoubleEditBox, DoubleEditBox does not have the edited value.
If I use a TextBox instead of a DoubleEditBox, everything works nicely.
How do i get the above stuff working for DoubleEditBox?
We are using a lot of Actipro editors and we are facing the same problem with many.
Thank you,
Kind Regards,
Vinay