I'm sending programmatically some text via InputManager to TextBox, but it does not fire PreviewTextInput before changing Text.
WPF application with on screen keyboard. In some cases (inputing currency etc.) text need to be validated before introducing to TextBox.
var target = TKeyboard.FocusedElement;
var eventArgs = new TextCompositionEventArgs(
Keyboard.PrimaryDevice,
new TextComposition(InputManager.Current, target, text))
{
RoutedEvent = UIElement.TextInputEvent
};
InputManager.Current.ProcessInput(eventArgs);
I need to add text programmatically and be able to validate it before inputing into TextBox. Maybe it's not possible this way and I need different approach?