How to: Create Multiple Controls for a Business Type

By default, a LightSwitch business type extension includes a control for displaying the data type on a screen. You can replace the control with a custom LightSwitch control or a set of controls, for example, one control for data that can be modified and a different control for read-only data.

To add a control to a business type extension

  1. In Visual Studio, open the business type extension solution.

  2. In Solution Explorer, choose the ProjectName.Lspkg node, where ProjectName is the name of your solution.

  3. On the menu bar, choose Project, Add New Item.

  4. In the Add New Item dialog box, choose Control.

  5. In the Name field, enter a name for the control, and then choose the Add button.

    The required files for the control are added to the solution in the Client, ClientDesign, Common, and Design projects.

  6. In Solution Explorer, choose the ProjectName.Common node, where ProjectName is the name of your solution.

  7. Open the shortcut menu for theControlName.lsml file, where ControlName is the name of the control that you added, and then choose Open With.

  8. In the Open With dialog box, choose XML (Text) Editor, and then choose the OK button.

  9. In the <Control.SupportedDataTypes> element, add the following code, and then replace BusinessType with the name of your business type.

    <SupportedDataType DataType=”BusinessType”/>
    

    Note

    If you do not want to support the default data type String, then also remove the line <SupportedDataType DataType=”:String”/>.

For information about how to add validation and properties to the control, see Walkthrough: Creating a Business Type Extension. For more information about how to customize the control, see How to: Create a LightSwitch Control

See Also

Tasks

Walkthrough: Creating a Business Type Extension

How to: Create a LightSwitch Control

Concepts

LightSwitch Extensibility Toolkit for Visual Studio 2013