Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Problem facing with implementation of MVVM

$
0
0

as i known about MVVM  "View Model" should not have Reference ofView or UI controls.

I have one requirement where i am facing problem with implementing in MVVM.

could you please help me in solving this..? it helps me a lot in understand as well.

Requirement :

I have a window which as Button and on click of Button i need to open a child window.

Problem:

1. I have created WPF window with a button.

2. On click of a button the Execute() method of Command is executed if i am right?[in view model i haveRelayCommand which implements ICommand with required methodsExecute() and it is binded with command property of Button] -->fireing of an event works fine.

3. Here the problem is that i need to open child window on click of a Button. but Child window can't access in View model because we know that it's View -- >can u please let me know how can i open child window on click of button.

becasue Execute() method written in View model and it is the event handler method. and i need to write code to open child window in the event handler method itself , am i correct?

Thanks,


Viewing all articles
Browse latest Browse all 18858

Trending Articles