Linked to the ViewModel TextBox . I'm running. I type the text into it, press the "Save" button, well, or another. And the text that I entered is not saved. Put a checkpoint on the event when data is sent to the model. As long as the cursor blinks in TextBox , the data in the VM is not sent, even if I press the other buttons on the form. You need to click in another TextBox field to transfer data.

 <TextBox Height="110" Text="{Binding Comment, Mode=TwoWay}" TextWrapping="Wrap"/> 

How to force it to transfer data when I pressed the button?

    1 answer 1

    Try installing from Binding

     UpdateSourceTrigger=PropertyChanged 

    The data in the VM will be updated immediately, without waiting for the loss of focus.

    • I've seen it somewhere .... Thank you - MaximK
    • @MaximK: Please, glad that helped! - VladD
    • public class SomeClass me more: here I created a class public class SomeClass and in it there is one function that returns a value public string SomeFunction . Now to call the function I need to do (new SomeClass()).SomeFunction() . And how to make, what not to cause new ? those. just SomeClass.SomeFunction() - MaximK
    • one
      @MaximK: Make the function static? - VladD
    • What you need ... Thank you - MaximK