Click here to Skip to main content
14,297,678 members
Rate this:
Please Sign up or sign in to vote.
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

Rate this:
Please Sign up or sign in to vote.

Solution 1

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.
   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100