title: Silverlight MVVM:Updating parent view model based on status of child View model
body: <p>I am new to Silverlight MVVM.
  I have one requirement to show checkbox in a parent child hierarchy.
  While loading the page if the child is checked then parent checkbox should also get checked.</p>
  
  <p>I have created a ViewModel as below </p>
  
  <pre><code>   public class TestViewModel : INotifyPropertyChanged
      {
    private string name;
          private string percent;
          private bool isChecked;
          internal event EventHandler CheckboxStateChanged = delegate { };
  
          private List&lt;TestViewModel&gt; testViewModel;
  
          public List&lt;TestViewModel&gt; TestViewModel1
          {
              get { return testViewModel; }
              set
              {
                  testViewModel = value;
                  NotifyPropertyChanged("TestViewModel1");
  
              }
          }
  
          public TestViewModel()
          {
              //IsChecked = true;
              //Name = "Hello";
              //Percent = "10";
          }
  
          public bool IsChecked
          {
              get { return isChecked; }
              set
              {
                  isChecked = value;
                  NotifyPropertyChanged("IsChecked");
                                 CheckboxStateChanged(this, new EventArgs());
  
              }
          }
  
  
       public event PropertyChangedEventHandler PropertyChanged;
              protected void NotifyPropertyChanged(string propertyName)
              {
                  if (PropertyChanged != null)
                  {
                      PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
                  }
              }
  
  }
  </code></pre>
  
  <p>In my main.xaml.cs I have created recursive method which will create the parent child hierarchy of checkboxes.
  On clicking the child checkbox, parent checkbox is getting checked as I have added eventhandler in my VM (CheckboxStateChanged ) for that.But while on page load if child is checked then parent also get checked,I am unable to do that..Pls help.</p>
  
  <p>Note I can not make parents checked until I get the status of child and once I get child status m not sure how to go back to parent.</p>
  
  <p>Parent VM contains list of same VM as children(i.e public List TestViewModel1)</p>