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, select 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, select 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, select the ProjectName.Common node, where ProjectName is the name of your solution.

  7. Open the ControlName.lsml file, where ControlName is the name of the control that you added.

  8. 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, seeWalkthrough: 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

Visual Studio LightSwitch 2011 Extensibility Toolkit