Answer the question
In order to leave comments, you need to log in
How to handle data in wpf textbox, C#?
Hello everyone, without introductions, let's move on to the problem: let's say I have 4 TextBoxes, and the Button button, when clicked, processes the data entered in the TextBoxes. How in the code to transfer to it the very data that was entered? I couldn't find an answer on the internet, maybe I just searched badly.
Answer the question
In order to leave comments, you need to log in
It is possible in two ways. The first one is to make the button click event handler in the code in the old fashioned way and take the values from the textboxes inside. The second is to make a binding to the model, in the ground, through the binding attribute, you bind the control to the model and on the button you bind to the command that will take data from the model. This option was mentioned by Stanislav Makarov .
You need a viewmodel, to the properties of which you will bind textboxes and a command sticking out also from this viewmodel, to which you will bind the button. Read about MVVM, ICommand and bindings in WPF.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question