Click here to Skip to main content
15,891,689 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

In my WPF application, I have a parent window Main.xaml where i have a button. On click of button i want to open a new window ChildWindow.xaml through command (and not through click event in code behind)
when the child form open I want to disable the Main.xaml window so that user cannot click anything on it.

I need it through MVVM so creating ChildWindow instance in the viewmodel I am not looking for. Can anybody please help me out.


Thanks.

What I have tried:

I am able to acheive it through code behined but I am looking through using MVVM
Posted
Updated 18-Oct-18 0:30am
v2

1 solution

You can bind your button to a command using RelayCommand() and

have the child Window being opened from the ViewModel using the Application.Current.MainWindow property to link your new child window to the existing MainWindow.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900