locked
Set visibility of controls based on actions on other controls RRS feed

  • Question

  • Hi,

    I need to set the visibility of some controls in a screen based on the value in a status field in the database that has been set by changing the value of another control.

    I have two checkboxes (flip switches): Action 1 and Action 2. Action 1 is the first action that needs to be done so Action 2 should be invisible until Action 1 is set to True. If set to True Action 1 needs to be hidden and the status field needs to be updated. If Action 2 is set to True the status should also be set and the control made invisible.

    I can't seem to find out how to do this. Is there some tutorial somehere or can someone give me a small example?

    Thanks,

    Willem

    Thursday, April 4, 2013 1:48 PM

Answers

  • Hi,

    You need to add an event listener to the Action1 control then within the event handler code you need can locate the Action2 control and set it to visible/invisible.

    The code below is an extract from this excellent tutorial ...

    http://blogs.msdn.com/b/lightswitch/archive/2013/03/18/signed-in-part-1-introduction-andy-kung.aspx

    In the above example an add/change listener is added to the HowFound control such that when fired will locate the Guest_Note and if the value of the HowFound is set to "Other" then o isVisible property of the Guest_Note control is set to true otherwise set to false

    Johnny Larue, http://www.softlandingcanada.com


    Thursday, April 4, 2013 3:12 PM

All replies

  • Hi,

    You need to add an event listener to the Action1 control then within the event handler code you need can locate the Action2 control and set it to visible/invisible.

    The code below is an extract from this excellent tutorial ...

    http://blogs.msdn.com/b/lightswitch/archive/2013/03/18/signed-in-part-1-introduction-andy-kung.aspx

    In the above example an add/change listener is added to the HowFound control such that when fired will locate the Guest_Note and if the value of the HowFound is set to "Other" then o isVisible property of the Guest_Note control is set to true otherwise set to false

    Johnny Larue, http://www.softlandingcanada.com


    Thursday, April 4, 2013 3:12 PM
  • Hi Johnny, 

    Great. Thanks for this.

    Willem

    Thursday, April 4, 2013 3:20 PM