How to: Add a Button to a Mobile Client for LightSwitch
For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.
When you develop an HTML mobile client for your LightSwitch app, you can add code that runs when the user taps a button on a screen in that client. For example, you might add code that launches a different screen or performs a calculation.
To add a custom button to a screen
In the Screen Content Tree, choose the node where you want the button to appear.
On the Screen Designer toolbar, choose the Add Layout Item drop-down list, and then choose Button.
The Add Button dialog box appears.
To use a built-in method
-
In the Add Button dialog box, choose the Choose an existing method option button.
In the showDialog list, choose the method to run.
If you choose a method that displays a screen or a dialog box, additional choices may appear. For more information, see How to: Control Navigation.
Choose the OK button to create the button.
To create your own method
-
In the Add Button dialog box, choose the Write my own method option button.
In the Method text box, enter a name for the button, and then choose the OK button.
In the Screen Content Tree, open the shortcut menu for the new button node and choose Edit Execute Code code.
The code editor appears.
In the code editor, add code that will run when the user taps the button.