silverlight - How to change the state of a checkbox by checking another checkbox in Microsoft Lightswitch -
i experimenting desktop app built microsoft lightswitch (currently working vs2013). have 1 screen "contacts" various controls , option hide contact (instead of deleting in case of future "resurrection"). respectively have screen hidden contacts.
what interests me how change value of 1 checkbox on screen based on value of checkbox?
so when set "hidden" true, "billing active" , "customer reporting" automatically set false.
what have far following:
partial void contact_changed() { // write code here. this.findcontrol("hidden").controlavailable += customer_hidden; this.setdisplaynamefromentity(this.customer); } private void customer_hidden(object sender, controlavailableeventargs e) { checkbox p = e.control 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; } }
the name of "billing active" checkbox "contractactive"
and not accomplish anything. whole purpose of thing sort of validation, i.e. once rid of someone, don't forget exclude him else :) display modal window popup warning or something, first interested in perhaps trivial problem.
thanks in advance!
edit: found how control checkboxes when on same screen:
partial void customerdetail_created() { dispatchers.main.begininvoke(() => ((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; } }
but if want change value of checkbox/other control in screen? partially works, if use same approach, screen 'triggers' change not saved (or appears not save).
not sure event have use / gets fired, when checking/unchecking checkbox top of head. but, in case should not work on controls , sure not on visibility. should more work on values of current item change those. try this:
contacts.selecteditem.billingactive = false;
kind regards simon
Comments
Post a Comment