I have a regular TextBox wpf control associated with the string property. I need the displayed text to be updated immediately after updating the binding or .Text property. I tried
((TextBox)sender).GetBindingExpression(TextBox.TextProperty).UpdateSource(); ((TextBox)sender).GetBindingExpression(TextBox.TextProperty).UpdateTarget();
in the TextChanged event handler.
I tried UpdateSourceTrigger=Explicit by binding. I tried
Application.Current.Dispatcher.BeginInvoke( DispatcherPriority.Input, new Action(() => { statusTextBox.Text = "newValue"; }));
and many different combinations. But the text is displayed only after the method I updated the text box from the outputs.
XAML:
<TextBox x:Name="txBox" Height="150" Margin="0,0,0,0" VerticalAlignment="Top" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" AcceptsReturn="True" VerticalContentAlignment="Top" Text="{Binding TextProperty}"Width="200" />
source share