title: How to change the state of a checkbox by checking another checkbox in Microsoft Lightswitch
body: <p>I am experimenting with a desktop app built with Microsoft Lightswitch (currently working with VS2013). I have one screen for "Contacts" with various controls and an option to hide that contact (instead of deleting it in case of future "resurrection"). Respectively I have a screen with the hidden contacts. </p>
  
  <p>What interests me is how to change the value of one checkbox on that screen based on the value of another checkbox?</p>
  
  <p><img src="https://i.stack.imgur.com/LNwZJ.jpg" alt="enter image description here"></p>
  
  <p>So when I set the "Hidden" to true, the "Billing Active" and "Customer Reporting" are automatically set to false. </p>
  
  <p>What I have so far is the following:</p>
  
  <pre><code>    partial void Contact_Changed()
      {
          // Write your code here.
          this.FindControl("Hidden").ControlAvailable += Customer_Hidden;
          this.SetDisplayNameFromEntity(this.Customer);
      }
  
      private void Customer_Hidden(object sender, ControlAvailableEventArgs e)
      {
          CheckBox p = e.Control as CheckBox;
          bool ap = p.IsChecked.Value;
          //bool p = System.Convert.ToBoolean(e);
          switch (ap)
          {
              case true:
                  this.FindControl("ContractActive").IsVisible = false;
                  break;
  
              case false:
                  this.FindControl("ContractActive").IsVisible = true;
                  break;
          }
      }
  </code></pre>
  
  <p>The name of the "Billing Active" checkbox is "ContractActive"</p>
  
  <p>And this does not accomplish anything. The whole purpose of the thing is sort of <strong>validation</strong>, i.e. once you get rid of someone, don't forget to exclude him from everything else :) I could also display a modal window popup with a warning or something, but first I am interested in that perhaps trivial problem. </p>
  
  <p>Thanks in advance!</p>
  
  <p>EDIT:
  Found how to control the checkboxes when they are on the same screen:</p>
  
  <pre><code>    partial void CustomerDetail_Created()
          {
              Dispatchers.Main.BeginInvoke(() =&gt; ((INotifyPropertyChanged)this.Customer).PropertyChanged += PropertyChanged);
      }
  
      private void PropertyChanged(object sender, PropertyChangedEventArgs e)
      {
          switch (Customer.Hidden)
          {
              case true:
                  this.Customer.Hidden = true;
                  this.Customer.BillingActive = false;
                  break;
  
              case false:
                  this.Customer.Hidden = false;
                  this.Customer.BillingActive = true;
                  break;
          }
      }
  </code></pre>
  
  <p>But what if I want to change the value of a checkbox/other control in another screen? This partially works, if I use the same approach, but the screen that 'triggers' the change is not saved (or it appears not to save). </p>