X
X
xXNullXx2020-01-08 21:41:29
WPF
xXNullXx, 2020-01-08 21:41:29

How to get the class object that is bound to the View?

Good day!
While I was studying how to create an application using the MVVM pattern, a question arose. Actually the details:
Task:
Create a functionality for adding tasks to the diary.
That is, when I click on the "OK" button, the command attached to the button should transfer the object of the "Task" class to the "Tasks" sheet of the "PlansPageVM" class, which in turn is attached to the "PlansPage" View. But to do this, I need to pass the actual object of the "PlansPageVM" class as a parameter to the command, the question is: how to do this?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
P
Peter, 2020-01-08
@xXNullXx

The functionality that is tied to the command that is on the "OK" button should be in the View Model, that is, already inside your PlansPageVM class

V
Vladimir Korotenko, 2020-01-08
@firedragon

Send button? What a mess you are.
The button is attached to the command, and in the team, if necessary, create a task and already pass it where you need it

R
Roman, 2020-01-09
@yarosroman

Your application architecture is built incorrectly, VMs should not know about each other at all, your tasks should be stored in one place, not in the VM at all, and the VM should read, add, edit the list of your tasks with the help of a service (third-party auxiliary class). And the service is already being implemented through IoC containers in the VM.

I
Igor Dmitrashko, 2020-02-20
@Gorik2927

The video is long but very informative!
It will immediately become clear what and where https://www.youtube.com/watch?v=N6RNy3rPZpg&featur...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question