0
votes

I want to send my View Object to my ViewModel, How can i do that in WPF MVVM.

Note:

Actually what i am trying to do is.. I have a MainWindow for which i am not following MVVM and this MainWindow has a Canvas in which i place all my views which are UserControls. Now from a Particular View called Stock i want to add a UserControl "another View" to the Canvas children on a Button Click from Stock View

1
You can't. Not if you are following MVVM. The ViewModel should have no knowledge of the View. Can you be more specific with what you are trying to do?cadrell0
Actually what i am trying to do is.. I have a MainWindow for which i am not following MVVM and this MainWindow has a Canvas in which i place all my views which are UserControls. Now from a Particular View called Stock i want to add a UserControl another View to the Canvas children. @cadrell0Kishore Kumar

1 Answers

5
votes

A view reference in your view model typically would be assigned on creation of your view.