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.

MainWindow.xaml:

  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:my="clr-namespace:WpfLab.Controls;assembly=WpfLab.Controls"
  xmlns:local="clr-namespace:parentchild.View"
  Title="MainWindow" Height="768" Width="1280">
   
   
 




ParentView.xaml:

  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  xmlns:controls="clr-namespace:parentchild.View"
  xmlns:vm="clr-namespace:parentchild.ViewModel"
  mc:Ignorable="d"
  d:DesignHeight="768" d:DesignWidth="1280">
 
 
 

 
 
 



 
 
 
 
 
 
 
 
 
 

 

 

 

 



ParentView.xaml.cs:


  public partial class ParentView : UserControl
  {
  public RumView()
  {
  InitializeComponent();
 
  this.DataContext = new ParentViewModel();
  }
  }
}


ParentViewModel.cs:
 public class ParentViewModel : INotifyPropertyChanged
  {
  private readonly IEventAggregator eventAggregator=new EventAggregator();

  private ParentModel currenparentModel;

  private string resultMessage;

  private bool _popupIsOpen;

  public RumViewModel()
  {
  currenrumModel = new RumModel();

  this.submitCommand = new DelegateCommand(this.Execute, this.CanExecute);
 
 
  }
  public bool IsPopupIsOpen
  {
  get { return _popupIsOpen; }
  set
  {
  _popupIsOpen = value;
  NotifyPropertyChanged("IsPopupIsOpen");
  }
  }
  public ParentModel currentparent
  {
  get
  {
  return currenparentModel
  }
  set
  {
  currenparentModel= value;
  }
  }
 
  public Visibility popupVisibility
  {
  get { return this.currenrumModel.popupVisibility; }
  set
  {
  this.currenrumModel.popupVisibility = value;
  this.NotifyPropertyChanged("popupVisibility");
  }
  }
  #region commands
  public ICommand submitCommand { get; private set; }
 
  #endregion

  private bool CanExecute(object arg)
  {
  return true;
 
  }

  private void Execute(object arg)
  {
  popupVisibility = Visibility.Visible;
  IsPopupIsOpen = true;
  } 
 
  private void RaiseCanExecuteChanged()
  {
  DelegateCommand tosscommand = tosscardCommand as DelegateCommand;
 
  cancelcommand.RaiseCanExecuteChanged();
  }
  #region INotifyPropertyChanged Members

  public event PropertyChangedEventHandler PropertyChanged;

  private void NotifyPropertyChanged(string propertyName)
  {
  if (this.PropertyChanged != null)
  {
  this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
  }
  }

  #endregion
}


ChildWindowView.xaml:
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  xmlns:viewModels="clr-namespace:parentchild.ViewModel"
  xmlns:views="clr-namespace:parentchild.View"
  mc:Ignorable="d"
  d:DesignHeight="500" d:DesignWidth="500">