M
M
Maxim Isaev2017-02-14 20:10:57
WPF
Maxim Isaev, 2017-02-14 20:10:57

How to add data from textbox to collection?

Good day, there is a collection of type ObservableCollection PhonesCollection;
Phone - a class analogous to a table in a database
How to add data from a textbox to a collection?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
d-stream, 2017-02-14
@MaximIs

The first method (in alphabetical order) of ObservableCollection is Add.
Actually this addition.
And textbox.Text is a string, which is probably one of the "bricks" of the class, the elements of which make up the collection.
That is, skipping models, view models, and the like. somewhere in the bowels there will be, for example, something
PhonesCollection.Add(
new PhonesCollectionElement(){
... a bunch of initializations, including the field=textbox.Text
}
)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question