How to close the popup window in wpf using MVVM?

Posted by Vpmanoharan under WPF on 9/17/2014 | Points: 10 | Views : 12814 | Status : [Member] | Replies : 3
Hi,

I created to 2 usercontrol for parent,child and one mainwindow. I refer the child window inside the popup control of parent window.In parent window i try to click the button popup window display.
Now i want close the popup window,when i try the click the childwindow submit button.Please help me.




Responses

Posted by: Naveenhcl on: 9/17/2014 [Member] Starter | Points: 25

Up
0
Down
Hi,

If you want to close the popup window then use simple jquery script.

function closeDialog() {
$("#dialog").dialog("close");
}


and call this function while closing time.

Vpmanoharan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Goud.Kv on: 9/18/2014 [Member] [MVP] Gold | Points: 25

Up
0
Down
Hello Manohar,

Below video tutorial might helps you... Please go with that,
http://www.dotnetfunda.com/videos/show/313/wpf-mvvm-step-by-step-windows-presentation-foundation

Thanks & Regards,
Krishna

Vpmanoharan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Qutyquteshweta on: 2/16/2017 [Member] Starter | Points: 25

Up
0
Down
We have the name property in the .xaml definition:
x:Name="WindowsForm"

Then we have the button:
<Button Command="{Binding CloseCommand}" 

CommandParameter="{Binding ElementName=WindowsForm}" />

Then in the ViewModel:
public DelegateCommand <Object>  CloseCommand { get; private set; }

Constructor for that view model:
this.CloseCommand = new DelegateCommand<object>(this.CloseAction);

Then at last, the action method:
private void CloseAction (object obj)

{
Window Win = obj as Window;
Win.Close();
}


Link: http://stackoverflow.com/questions/4376475/wpf-mvvm-how-to-close-a-window

Regards,
Shweta
http://www.shwetalodha.blogspot.com

Vpmanoharan, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response